Python2 project essay-1, python2 essay-1

Source: Internet
Author: User

Python2 project essay-1, python2 essay-1

Python version: 2.7.13
Django version: 1.9.8
Use pycharm
Run the tool --> Run manage. py Task to enter manage. py.
Configure the browser to run --> Edit Configurations...
Mark resources: After this is set, the selected folder --> right-click --> mark Directory as --> Sources Root will not be reported if the corresponding file is not introduced.
After setting this, you can quickly import the selected Folder --> right-click --> mark Directory as --> Template Folder

          
  

1. File structure
Apps-the location where the app is stored
Log-the location where logs are stored,
Static -- stores static resources, such as js, css, and img.
Media-stores video resources
2. Install mysql-python
Http://blog.csdn.net/u012882134/

To python2, pip install mysql-python
Handle error: http://blog.csdn.net/u012882134/
Find http://www.lfd.uci.edu /~ Gohlke/pythonlibs/# mysql-python
Search for mysql-python and find the corresponding mysql-python version.
Download files
32-bit MySQL_python plugin 1.2.5 unzip cp27 plugin none unzip win32.whl
64-bit MySQL_python 255.1.2.5 255.cp27 without any other win_amd64.whl
Put it in the python2 folder and execute
32-bit pip install MySQL_python before 1.2.5 when cp27 then none else win32.whl
64-bit pip install MySQL_python route 1.2.5 route cp27 route none route win_amd64.whl
3. Set mysql connection
Setting. py
DATABASES = {
'Default ':{
'Engine': 'django. db. backends. mysql ',
'Name': "testdjango ",
'User': "root ",
'Password': "123456 ",
'Host': "127.0.0.1 ",
}
}

4. Set the static resource path
Setting. py
STATICFILES_DIRS = [
OS. path. join (BASE_DIR, 'static ')
]


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.