MMMMMCCLXXVII
MMMMMCCLXXVII

Reputation: 581

what's the choice should be done with django_wsgi and wsgi

My current version of django is 1.6.3

And i want to deploy django on my centos server with uwsgi and nginx.

There's a tutorial posted by someone who use 1.3's django that says it should create a file named django_wsgi.py inside my django project. I was wondering if this step could be ignored because i already have wsgi.py in my project at beginning. Are django_wsgi.py and wsgi.py the same thing? Just change the name along with the version upgrade.

#django.py
mport os
import sys
sys.path.append("/opt/www") 
os.environ['DJANGO_SETTINGS_MODULE'] = 'your_project.settings' 
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

#wsgi.py
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "netmag.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

Upvotes: 1

Views: 88

Answers (2)

alecxe
alecxe

Reputation: 473753

The project structure generated by startproject changed since 1.3. Before 1.4 release, you had to manually create a wsgi file. Since 1.4, Django automatically creates wsgi.py file in the project root.

Continue using wsgi.py that Django created for you.

Upvotes: 1

Yuval Adam
Yuval Adam

Reputation: 165182

A Django 1.6 already has a default WSGI configuration as you can see in your wsgi.py file, nothing else is needed. The instructions you mention are for legacy Django projects.

See https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/ for more information on the Django WSGI config.

Upvotes: 1

Related Questions