6 ms·
It's annoying how there is no canonical way to do it. You need to spend some mental energy learning how to do this when starting up a Django project. Django sho
by rmc 15y ago
It's annoying how there is no canonical way to do it. You need to spend some mental energy learning how to do this when starting up a Django project. Django should really integrate one solution into the django core, and then everyone can just use that. Make it much easier.
- 5h 15y agoI feel the opposite, Over the 3 years or so I've worked with django full time there have been very good reasons to have different setups wrt environment, virtualenvs & web servers. That said I tend to use env vars to identify which environment an app is running in and build everything off that, which branch / db / logging target etc to use.
- talaketu 15y ago> use env vars to identify which environment an app is running in Be aware about issues between mod_wsgi and that approach - http://code.google.com/p/modwsgi/wiki/ApplicationIssues#Application_Environment_Variables http://code.google.com/p/modwsgi/wiki/ApplicationIssues#Appl...
- 5h 15y agoI'm aware of those, thankfully the things I set wont change within the life a single environment, a single variable to say dev/test/staging/production, could easily set in bashrc & wsgi script.
- kennu 15y agoHaving an opinionated, best practice default doesn't have to prevent customization. I have always thought Rails is better than Django in this sense. There's one clear default way to do things, and then you can customize if you need to.
- streeter 15y agoEnvironment variables work extremely well when deploying on Heroku [1]. You can't exactly commit a local_settings.py file to your repo, so setting env variables is the only way to exclude sensitive keys and passwords from your source control. [1] http://rdegges.com/devops-django-part-3-the-heroku-way http://rdegges.com/devops-django-part-3-the-heroku-way
- pipy 15y agoAm I the only person that uses pure and simple symlinks? https://en.wikipedia.org/wiki/Symbolic_link https://en.wikipedia.org/wiki/Symbolic_link
- a_a_r_o_n 15y ago"Am I the only person ..." The answer to this is always no.
- rmc 15y agoThe problem with symlinks is that there's manual intevention needed when you deploy.
- pipy 15y agoNot at all. Store settings_dev.py and settings_prod.py in your repository. What will be different on production machine and on local one is the symlink file called settings.py.
- bobbyi 15y agoThen how do your tests find their config? If they also rely on the symlink, then you have to flip it back and forth when you run the tests, which is error-prone. If the tests ignore the symlink and "know" that they should instead load the test config, then you have to make sure that subprocesses started by the tests (e.g., by running "./script/whatever.py" from test code) don't follow the default behavior of using whatever settings the symlink currently points to or your tests may end up hitting your production database. With environment variables, it is automatic that subprocesses with inherit the parent's environment and use the same settings.
- tvon 15y agoI like Django quite a bit, but it boggles the mind how many developer hours have been spent solving the same basic setup problem over and over again.