Looking for best practices regarding Development and production server paths

2013-03-21 Thread DJ-Tom
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?

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?

So far that's all I can think of right now - but I'm sure a lot more 
questions will rise the next few days :-)

Thomas

-- 
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.




Re: Looking for best practices regarding Development and production server paths

2013-03-21 Thread Sreenivas Reddy T
On Thu, Mar 21, 2013 at 5:05 PM, DJ-Tom  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?
>
> Simple, you maintain two settings.py files, make one with Dev_settings.py
and  two with Prod_settings.py.
You can run dev and production  applications like this

python manage.py runserver --settings=Dev_settings

python manage.py runserver --settings=Prod_settings

it is all about switching between settings.py files.



> I suppose I do not have to adjust those paths every time I upload a new
> version of my application?
>
> 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?


> So far that's all I can think of right now - but I'm sure a lot more
> questions will rise the next few days :-)
>
> Thomas
>
>  --
> 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.
>
>
>

-- 
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.




Re: Looking for best practices regarding Development and production server paths

2013-03-21 Thread Tom Evans
On Thu, Mar 21, 2013 at 11:35 AM, DJ-Tom  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.




Re: Looking for best practices regarding Development and production server paths

2013-03-21 Thread DJ-Tom



>
> On Thu, Mar 21, 2013 at 5:05 PM, DJ-Tom  >wrote:
> Simple, you maintain two settings.py files, make one with Dev_settings.py 
> and  two with Prod_settings.py.
> You can run dev and production  applications like this 
>
> python manage.py runserver --settings=Dev_settings
>
> python manage.py runserver --settings=Prod_settings
>
> it is all about switching between settings.py files. 
>  


This won't work for me since I'm not using "runserver" on the production 
machine, but Apache/WSGI 

-- 
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.




Re: Looking for best practices regarding Development and production server paths

2013-03-21 Thread DJ-Tom


Am Donnerstag, 21. März 2013 13:04:53 UTC+1 schrieb Tom Evans:
>
> 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'), 
>   ) 
>

Ok - this should do the job nicely :-) Thanks! 

-- 
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.