个
我部署的设置: 项目结构法:
sites/
└── motivate-me.local
├── project
│ ├── api
│ │ ├── __pycache__
│ │ └── v1
│ │ └── __pycache__
│ └── project
│ └── __pycache__
└── static
├── admin
│ ├── css
│ ├── img
│ │ └── gis
│ └── js
│ └── admin
└── rest_framework
├── css
├── img
└── js
django.wsgi:
import os
import sys
sys.path.append('/home/mikhail/sites/motivate-me.local/')
sys.path.append('/home/mikhail/sites/motivate-me.local/project/')
sys.path.append('/usr/local/lib/python3.3/dist-packages')
os.environ['DJANGO_SETTINGS_MODULE'] = 'project.settings'
from django.core.handlers.wsgi import WSGIHandler
application = WSGIHandler()
我的主机:
127.0.0.1 localhost
127.0.0.2 www
127.0.0.3 loss-weight.local
127.0.0.4 test.local
127.0.0.5 motivate-me.local
127.0.1.1 ube-work
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
我的虚拟主机:
<VirtualHost 127.0.0.5:80>
ServerAdmin [email protected]
ServerName motivate-me.local
ServerAlias motivate-me.local
WSGIScriptAlias//home/mikhail/sites/motivate-me.local/project.wsgi
WSGIPassAuthorization on
DocumentRoot /home/mikhail/sites/motivate-me.local
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/mikhail/sites/motivate-me.local/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
Alias /static/ /home/mikhail/sites/motivate-me.local/static/
<Location "/static/">
Options -Indexes
</Location>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
您的模板目录在settings.py文件中的外观如何? –
TEMPLETE_DIRS =( '/ var/www/TEServices/templates', ) –
当您没有提供任何有关您的Apache配置,您使用的URL,Django的详细信息时,我们希望诊断您的Apache安装程序urls.py和视图代码,或其他任何相关的? –