Forums

Live vs development Django project versions on Pythonanywhere

Hi,

I was wondering what the best workflow is on Pythonanywhere for having actualy two versions of a project. One is the development version, which should be only available for the devs and one, which is actually live.

Of course only the live version should be available to the public via its own domain.

You could have a common git repo where you have a dev branch and a live branch. Do all of your work on the dev branch and have that checked out in the development web app. When you're ready to publish, merge onto the live branch and pull in the live web app.

The suggestion to keep a branch that reflects the live site is a good one. One additional thing I do is seperate out the live and dev settings into different files then conditionally import those into the settings.py file depending on which site you I'm working on.

So for example you have:

#settings.py
from .local_settings import * #import the settings specific to the environment (dev or live)
#other common settings go in here...

#local_settings.py
from .dev_settings import *

#dev_settings.py
DEV_SPECIFIC_SETTING = 123

This way you can keep settings.py dev_settings.py and live_settings.py in version control by keeping local_settings out of version control.

Thanks a lot for your feedback.