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 ')
]