[英]How deploy multiple django 1.6 project with mod_wsgi
I'm a new in all about Django deployment, i'm actually try to deploy my first app in my server, but i want do this in a subdomain and, in a future, in others subdomains deploy more apps. 我是有关Django部署的新手,实际上我尝试在服务器中部署我的第一个应用程序,但是我想在子域中执行此操作,将来,在其他子域中,请部署更多应用程序。
Exist any guide for do this for Django 1.6? 是否有针对Django 1.6的指南?
I've seen a lot of blogs for deploy Django with mod_wsgi but are so old (2010, 2011, 2012, etc) and are only for deploy only one app. 我见过很多博客,这些博客都使用mod_wsgi来部署Django,但这些博客已经很老了(2010、2011、2012等),并且仅用于部署一个应用程序。
I've seen too that some people use Virtual Host and others use httpd configuration without Virtual Host, and that is so confused for me. 我也看到有些人使用虚拟主机,而其他人使用没有虚拟主机的httpd配置,这对我来说很困惑。
Its more easy if i use GUnicorn and Nginx? 如果我使用GUnicorn和Nginx会更容易?
Which solution is better? 哪种解决方案更好?
Centos 6.5
Python 2.7
Django 1.6.2
This is my configuration that isn't work: 这是我的配置,不起作用:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.myserver.com
ServerAlias www.myserver.com/holding
DocumentRoot /var/www/html/holding/src
ErrorLog /var/www/html/holding/log/holding.log
CustomLog /var/www/html/holding/log/access.log combined
ServerAdmin helio.gutierrez@myserver.com
WSGIScriptAlias / /var/www/html/holding/src/wsgi.py
Alias /robots.txt /var/www/html/holding/src/robots.txt
Alias /favicon.png /var/www/html/holding/src/static/ico/favicon.png
Alias /static/admin/ /usr/local/lib/python2.7/site-packages/django/contrib/admin/static/admin
Alias /static/ /var/www/html/holding/src/static
Alias /media/ /var/www/html/holding/src/media
<Directory /var/www/html/holding/src>
Order allow,deny
Allow from all
</Directory>
<Directory /var/www/html/holding/src/media>
Order deny,allow
Allow from all
</Directory>
<Directory /var/www/html/holding/src/static>
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
import os, sys
sys.path.append('/usr/local/lib/python2.7')
sys.path.append('/usr/local/lib/python2.7/site-packages/django')
sys.path.append('/var/www/html/holding')
sys.path.append('/var/www/html/holding/src')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "src.settings")
#from django.core.wsgi import get_wsgi_application
#application = get_wsgi_application()
from django.core.handlers.wsgi import WSGIHandler
application = WSGIHandler()
Here is a past Stack Overflow post where there is an example of adding multiple sites. 这是过去的Stack Overflow帖子 ,其中有添加多个站点的示例。
It is from 2009, but it should still work. 是从2009年开始的,但仍然可以使用。
I personally used uwsgi with nginx, but gunicorn is really easy to setup too. 我个人将uwsgi与nginx一起使用,但是gunicorn真的也很容易设置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.