On Thu, Mar 21, 2013 at 11:35 AM, DJ-Tom <eventel...@gmail.com> wrote:
> Hi,
>
> I'm still a beginner and currently I'm trying to get more familiar with
> Django.
>
> I'm looking for any more detailed best-practices-type description on how the
> development cycle is meant to be managed.
>
> In settings.py, there are paths like TEMPLATE_DIRS and STATICFILE_DIRS, how
> is this supposed to work when paths on the development machine differ from
> the production server?
>
> I suppose I do not have to adjust those paths every time I upload a new
> version of my application?

The easiest way to do this is to specify them in terms of relative
path to the settings file.

Eg, I have this structure for my projects

websitename
├── app1
├── app2
├── manage.py
├── project
│   ├── settings.py
│   └── urls.py
├── static
└── templates

In my settings.py, I set the path to the project template folder and
project static files like so:

import os.path
ROOT = os.path.abspath(__file__).rsplit(os.path.sep, 2)[0]
TEMPLATE_DIRS = (
  os.path.join(ROOT, 'templates'),
  )
STATICFILES_DIRS = (
  os.path.join(ROOT, 'static'),
  )

This then works in both dev, test and live, since the structure is the
same on all three.

>
> Another point, how do I manage the time until the database schemes are
> updated to a new version (I'm planning to use south for database scheme
> maintenance) and nobody is supposed to use the application until
> everything's able to work again?
>

Easiest way is to stop people accessing your web app when you don't
want them to, and re-enable it afterwards. Depending on how you are
hosting Django, there can be a number of different solutions. Eg, for
my sites, hosted with Apache and FCGI, I simply stop the FCGI app, and
Apache shows an appropriately pretty 500 page.

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to