Reputation: 2204
I'm new to Django deployment and I want to know what are the steps we need to consider before deploying django project on the production server. I don't want informations about the server detailed setup. But I need informations about how similar should have to be the production environment from development environment. Because I'm getting some mysterious errors where the code from the development server which has no problem is not working in the production server. You can see the question I posted before django views - 502 bad gateway Still I didn't get the solution.
Do we need to have the same versions of the software in the production server as we are having in the development server? I think I will deserve some downvotes for this type of question but I'm hoping I will get an answer.
Thanks!
Upvotes: 3
Views: 563
Reputation: 55972
If you are creating your app on development using a certain version of a python package then those same versions should be used on production. You can use virtualenv
to achieve this. http://www.doughellmann.com/projects/virtualenvwrapper/
Using a virtualenv will allow you to seperate all the packages dependencies for your application and their versions. You will be able to create a text file with a list of all packages and versions and install them easily into a virtual environment on any server. This assures that packages on production are the exact same as on development.
Your development environment and production environment should be the exact same EXCEPT you will probably want to use the built in development server. It is leightweight and single threaded making debugging applications a breeze. This means you will most likely want a staging envrionment as well where you can test your app on the same server you will be using for production.
Deployment is difficult. Luckily python has some very great tools that make it pretty easy to replicate environments. These include virtualenv
and fabric
Upvotes: 3