Robert
Robert

Reputation: 661

howto setup wsgi.py for dev and prod for django and apache

What is the common way use production / dev setup on apache?

I have followings:

myproject
|
|── __init__.py
├── __init__.pyc
├── settings
│   ├── base.py
│   └── production.py
|   |__ dev.py
├── urls.py
├── urls.pyc
├── wsgi.py
└── wsgi.pyc

In my wsgi.py file:

path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if path not in sys.path:
    sys.path.append(path)

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myproject.settings.production")

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

This does not work, when I move production.py one level up and change setdefault to "myproject.production" that working fine, but I want to keep my settings in separated folder. Is any other way to do this?

Upvotes: 0

Views: 459

Answers (1)

Daniel Roseman
Daniel Roseman

Reputation: 599630

You just need an empty __init__.py file in the settings directory.

Upvotes: 3

Related Questions