一、django.core.exceptions.ImproperlyConfigured: The TEMPLATE_DIRS setting must be a tuple. Please fix your settings.javascript
解決方法:css
在項目的setting.py文件中修改相關的文件腳本html
TEMPLATE_DIRS = (
os.path.join(os.path.dirname(__file__), 'templates').replace('\\', '/'),
)java
二、「Unknown command syncdb」 running 「python manage.py syncdb」python
因爲使用了django1.9而1.9中的syncdb已被移除,所以如需建立數據庫則應該使用python.exe manage.py createsuperusermysql
進行從新初始化數據庫則須要使用一下方法jquery
先manage.py makemigrationssql
再進行manage.py migrate數據庫
三、靜態的文件訪問問題django
首先設置配置setting
STATICFILES_DIRS = (
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
os.path.join( os.path.dirname(__file__),'static').replace('\\','/'),
)
其次設置配置templates路徑
TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
os.path.join( os.path.dirname(__file__),'tempates').replace('\\','/'),
)
最後能夠進行訪問
<link rel="stylesheet" href="css/style.css" type="text/css">
<link rel="stylesheet" href="css/reset.css" type="text/css">
<link rel="stylesheet" href="css/home.css" type="text/css">
<script type="text/javascript" src="js/jquery-1.7.1.js"></script>
<script type="text/javascript" src="js/jquery.wookmark.js"></script>
訪問css等樣式
<link rel="stylesheet" href="../static/css/style.css" type="text/css">
<link rel="stylesheet" href="../static/reset.css" type="text/css">
<link rel="stylesheet" href="../static/css/home.css" type="text/css">
<script type="text/javascript" src="../static/js/jquery-1.7.1.js"></script>
<script type="text/javascript" src="../static/js/jquery.wookmark.js"></script>
四、WARNINGS:
?: (1_8.W001) The standalone TEMPLATE_* settings were deprecated in Django 1.8 a
nd the TEMPLATES dictionary takes precedence. You must put the values of the fol
lowing settings into your default TEMPLATES dict: TEMPLATE_DIRS.
解決方法:
把 TEMPLATE_DIRS 刪了
五、raise ImproperlyConfigured("settings.DATABASES is improperly configured. "
django.core.exceptions.ImproperlyConfigured: settings.DATABASES is improperly co
nfigured. Please supply the ENGINE value. Check settings documentation for more
details.
解決方法:
E:\Python34\Scripts>pip
Fatal error in launcher: Unable to create process using '"E:\Python34\python.exe
" "E:\Python34\Scripts\pip.exe" '
緣由:因爲路徑含有空格
解決辦法:python -m pip install Django
緣由:
一、因爲其模塊已在Python3中不支持
二、缺失C++模塊
解決辦法:
從新安裝PyMySQL或者是安裝C++,並更改配置
VS120COMNTOOLS=D:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/Tools/
有而VS100COMNTOOLS沒有。
而後固然set VS100COMNTOOLS=%VS120COMNTOOLS%
另外,從D:/Program Files (x86)/Microsoft Visual Studio 12.0/VC下面拷貝一個vcvarsal.bat到
D:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/Tools/
下面便可。