Exporting a development django application to production
I've been developing a django web-application for three months now, and I'd like to set it to production. I'm currently using South as database schema manager and I haven't got any clue on how to export my application databases schemas and content, and my project co开发者_JAVA技巧de to another directory; in order to set my production environment.
Any clue on how to do this?
Thank you.
I use the approach documented here. With this arrangement, you have common, production, dev, and test settings. Works for me.
I am not sure what you meant, but if you are looking for ways to move your django app from development to production server, try this or this.
Steps to get your Django App from development to Production
open your project folder then find
settings.py
find the following line,SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
Change the debug to false.
Change your db credentials with the actual production server db credentials in your
settings.py
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'seocrawler', 'USER': '', 'PASSWORD': '', 'HOST': 'localhost', 'PORT': '' } }
once done upload your project folder to the folder in server
open putty enter your server credentials, then a terminal or cmd will pop up.
check python is installed on your server by executing below command in terminal
python -V
then check whether django is installed by running
django-admin --version
, make sure that the django version you used to develop the project matches the one on server if not the install the specific version.now using the
cd
command to go to the project folder which containsmanage.py
file.now run
python manage.py showmigrations
this will list if any db migration is pending for your project.now run
python manage.py makemigrations
this will migrate the db tables to production server database.now run
python manage.py runserver 0.0.0.0:8000
then go to your domain likewww.example.com:8000
in browser, to test whether your site is working.once your site is up and working we want python manage.py runserver command to run even after the terminal is closed (means python manage.py runserver command in as background task/process).
to do that run
nohup python manage.py runserver &
this will run command in background and will never die the process even when putty terminal is closed.All done! now your server is up and your site too.
Enjoy!
精彩评论