LoadModule python_module /usr/lib/apache2/modules/mod_python.so
<VirtualHost *:80>
ServerName www.example.com
<Location "/mysite1">
SetHandler python‐program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE mysite1.settings
PythonAutoReload Off
PythonDebug Off
PythonPath "['/var/www/html/mysite1'] + sys.path"
PythonInterpreter mysite1
</Location>
<Location "/mysite2">
SetHandler python‐program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE mysite2.settings
PythonAutoReload Off
PythonDebug Off
PythonPath "['/var/www/html/mysite2'] + sys.path"
PythonInterpreter mysite2
</Location>
[......]
</VirtualHost>
/etc/init.d/apache2 restart
LoadModule python_module /usr/lib/apache2/modules/mod_wsgi.so
<VirtualHost *:80>
ServerName www.example
DocumentRoot /var/www/html/mysite
WSGIScriptAlias / /var/www/html/mysite/apache/django.wsgi
<Directory />
Order deny,allow
Allow from all
</Directory>
<Directory /apache>
Allow from all
</Directory>
</VirtualHost>
# filename:mysite.apache.django.wsgi import os, sys #Calculate the path based on the location of the WSGI script. apache_configuration= os.path.dirname(__file__) project = os.path.dirname(apache_configuration) workspace = os.path.dirname(project) sys.path.append(workspace) os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings' os.environ['PYTHON_EGG_CACHE'] = '/tmp' import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler() print >> sys.stderr, sys.path shell>chmod a+x django.wsgi
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'mysite',
'USER': 'admin',
'PASSWORD': 'admin123',
'HOST': '127.0.0.1',
'PORT': '3306', }
}
TEMPLATE_DIRS = (
'/var/www/html/mysite/templates',
)
/etc/init.d/apache2 restart
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有