Reputation: 97
I had a very beta (probably alpha) version of a website for a club I'm in built in Django, but it's now time to overhaul the backend into something that's actually highly functional. I've saved all of my files (old code, including templates, and Django configuration), but I've started fresh with a brand new installation of Ubuntu 14.04 on a Linode server. I want to do this the right way, but I'm having trouble distilling the "right" way to do things from various sources online.
How do I go about setting up the right user accounts for this project? For the sake of argument, let's say that Ed and Edna are working on a project. Ed and Edna both have an account on the server. Does the Django code live in one of their accounts, does it get an account for itself, or does it live somewhere else entirely where it doesn't need an account?
I've heard about Python virtual environments, but even after reading about them, I'm still unsure as to why I would want to use one if this web server is dedicated solely to this website. Assuming I do want to do it, do I install it from Ed's account? Edna's? A different account? Does the folder structure of the virtual environment live in Ed's or Edna's home folder? A different home folder?
One final question, then, regarding the web server configuration (I'm familiar with nginx, so that's what I'll be using). I should probably open a new question, but hopefully someone here will be able to shed some light. Where is the best place to store the static "Website under maintenance" page? Nginx put its "Welcome to nginx" page in /usr/share/nginx/html, though I need to sudo to edit it. I don't remember having to do this when I was last working on this project, and it doesn't seem intuitive that I should need to be root to edit a simple welcome page, so I'm wondering if I've done something wrong or nonstandard.
Thank you in advance!
Upvotes: 2
Views: 868
Reputation: 599788
This is all a bit subjective, but I'll tell you what I do.
First, the only reason your developers should have accounts is to allow them to deploy the code. They shouldn't be storing anything at all in their home directories, let alone the actual project.
The code to serve the site needs to be somewhere central. I like deploying under /srv/<sitename>
, but it's up to you; as long as it's not under /var/www
you should be OK. The main thing is that the account the server process is running under needs to have access.
Virtualenvs are good practice no matter what. Apart from anything else, they do simplify the deployment process, since no-one needs the ability to write to the main site-packages directory, just the one inside the virtualenv. Also, you may find yourself needing to run separate projects on the same server at some point, at which point virtualenv becomes a necessity.
Upvotes: 4