Home:ALL Converter>How to work with a local development server and deploy to a production server in django?

How to work with a local development server and deploy to a production server in django?

Ask Time:2015-01-10T06:19:38         Author:kristian

Json Formatter

I want to work locally on my django(1.7) project and regularly deploy updates to a production server. How would you do this? I have not found anything about this in the docs. I am confused about that because it seems like many people would want to do that and there should be some kind of standard solution to this. Or am I getting the whole workflow wrong?

I should note that I'm not expecting a step-by-step guide. I am just trying to understand the concept.

Author:kristian,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/27870178/how-to-work-with-a-local-development-server-and-deploy-to-a-production-server-in
user1631075 :

Assuming you already have your deployment server setup, and all you need to do is push code to your server, then you can just use git as a form of deployment. \n\nDigital Ocean has a good tutorial at this link https://www.digitalocean.com/community/tutorials/how-to-set-up-automatic-deployment-with-git-with-a-vps",
2015-01-10T01:31:14
Andrew_Lvov :

Push sources to a git repository from a dev machine.\npull sources on a production server. Restart uwsgi/whatever.",
2015-01-10T00:30:23
kaleissin :

There is no standard way of doing this, so no, it cannot be included with Django or be thoroughly described in the docs.\n\nIf you're using a PaaS how you deploy depends on the PaaS. Ditto for a container like docker, you must follow the rules of that particular container.\n\nIf you're old-school and can ssh into a server you can rsync a snapshot of the code to the correct place after everything else is taken care of: database, ports, webserver setup etc. That's what I do, and I control stuff with bash scripts utilizing a makefile.\n\nREMOETHOST=user@yourbox\nREMOTEPATH=yourpath\nREMOTE=$REMOTEHOST:$REMOTEPATH\n\nmake rsync REMOTE_URI=$REMOTE\nssh $REMOTEHOST make -C $REMOTEPATH deploy\n\n\nMy \"deploy\"-action is a monster but might be as easy as something that touches the wsgi-file used in order to reload the site. My medium complex ones cleans out stale files, run collectstatic and then reloads the site. The really complex ones creates a timestamped virtualenv, cloned database and remote code tree, a new server-setup that points to this, runs connection tests on the remote and if they succeed, switches the main site to point to the new versioned site, then emails me the version that is now in production, with the git hash and timestamp.",
2015-05-12T11:25:44
yy