开发者

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

  1. 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.

  2. 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': '' } }

  3. once done upload your project folder to the folder in server

  4. open putty enter your server credentials, then a terminal or cmd will pop up.

  5. check python is installed on your server by executing below command in terminal python -V

  6. 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.

  7. now using the cd command to go to the project folder which contains manage.py file.

  8. now run python manage.py showmigrations this will list if any db migration is pending for your project.

  9. now run python manage.py makemigrations this will migrate the db tables to production server database.

  10. now run python manage.py runserver 0.0.0.0:8000 then go to your domain like www.example.com:8000 in browser, to test whether your site is working.

  11. 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).

  12. 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.

  13. All done! now your server is up and your site too.

  14. Enjoy!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜