Re: Development / Production Setup

2007-06-23 Thread marknca

Thank you both SmileyChris & Nimrod putting what you've both suggested
solved the issues!

I really appreciate the help.

Cheers,
   Mark


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Development / Production Setup

2007-06-22 Thread SmileyChris

> I'm obviously missing something basic. I'm 99% sure I should be able
> to say something like:
>
>  media="screen" />

Assuming you have SVN...

Make sure you have this enabled in your TEMPLATE_CONTEXT_PROCESSORS
(it is by default):
http://www.djangoproject.com/documentation/templates_python/#django-core-context-processors-media

Use RequestContext (generic views do automatically). It's made easy
with http://www.djangosnippets.org/snippets/3/

In your template, you'll have the {{ MEDIA_URL }} context variable
ready for your enjoyment (which will equal settings.MEDIA_URL)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Development / Production Setup

2007-06-21 Thread Nimrod A. Abing

See: http://dpaste.com/12716/

What you can do is setup a conditional like that in your settings.py
where settings will be loaded based on your current hostname. This is
what I have been doing for quite some time now and seems to work well.

For templates, you have to set URL_PREFIX, MEDIA_PREFIX, BASE_URL and
others in your Context so that you can use them in your templates.
Here is how I use them:

URL_PREFIX - Used in hyperlinks to relative URLs
MEDIA_PREFIX - Used in URLs for media files such as CSS
BASE_URL - Used whenever absolute URLs are needed

On 6/22/07, marknca <[EMAIL PROTECTED]> wrote:
>
> I've been hacking around and googling for a little while now and can't
> seem to track down a solution to what should be a pretty straight
> forward problem.
>
> The situation
> 
> I'm trying to setup a nice workflow between my development environment
> and my production environment. I would like to be able to move changes
> from development to production with a minimum of hassle.
>
> Production setup
> =
> I'm serving all the dynamic pages using Apache/mod_python. All static
> content (images, scripts, styles, etc.) are served from a _different_
> subdomain running lighttpd. This setup seems to work well and is in
> line with what's recommended in the documentation (with the exception
> of the different subdomain).
>
> domain.tld => Django running on Apache/mod_python
> sub.domain.tld => static content served from lighttpd
>
> Development setup
> ===
> I've setup development much the same way. The difference here is the
> server software. My development machine is Mac and my production
> server is running Ubuntu. The development environment is running
> straight from IP. So I've got:
>
> ip:8000 => Django running on manage.py
> ip:80 => static content served from Personal Web Sharing (basically
> Apache)
>
> Django configuration
> 
> I have 2 settings.py files (settings.py.development &
> settings.py.production). One for development and one for production.
> Each has the settings for the servers in the specific environment.
> Right now I simply copy whichever settings.py.* file to settings.py
> for the environment I'm working in at the time.
>
> Problem
> ===
> Templates! I'd like to refer to my local static files when running in
> my development environment. How do I setup the templates to use the
> proper static files.
>
> Right now my templates include lines like:
>
> http://sub.domain.tld/styles/base.css";
> type="text/css" media="screen" />
>
> I'm obviously missing something basic. I'm 99% sure I should be able
> to say something like:
>
>  media="screen" />
>
> I have looked around for a solution but everything seems to point to
> the Site object (which requires a different entry in the database
> which I want to avoid, development should be a near exact mirror of
> production) or passing a variable through a view (these changes should
> be global).
>
> I'm new so please be gentle.
>
> Thanks in advance,
> Mark
>
>
> >
>


-- 
_nimrod_a_abing_

http://abing.gotdns.com/
http://www.preownedcar.com/

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Development / Production Setup

2007-06-21 Thread marknca

I've been hacking around and googling for a little while now and can't
seem to track down a solution to what should be a pretty straight
forward problem.

The situation

I'm trying to setup a nice workflow between my development environment
and my production environment. I would like to be able to move changes
from development to production with a minimum of hassle.

Production setup
=
I'm serving all the dynamic pages using Apache/mod_python. All static
content (images, scripts, styles, etc.) are served from a _different_
subdomain running lighttpd. This setup seems to work well and is in
line with what's recommended in the documentation (with the exception
of the different subdomain).

domain.tld => Django running on Apache/mod_python
sub.domain.tld => static content served from lighttpd

Development setup
===
I've setup development much the same way. The difference here is the
server software. My development machine is Mac and my production
server is running Ubuntu. The development environment is running
straight from IP. So I've got:

ip:8000 => Django running on manage.py
ip:80 => static content served from Personal Web Sharing (basically
Apache)

Django configuration

I have 2 settings.py files (settings.py.development &
settings.py.production). One for development and one for production.
Each has the settings for the servers in the specific environment.
Right now I simply copy whichever settings.py.* file to settings.py
for the environment I'm working in at the time.

Problem
===
Templates! I'd like to refer to my local static files when running in
my development environment. How do I setup the templates to use the
proper static files.

Right now my templates include lines like:

http://sub.domain.tld/styles/base.css";
type="text/css" media="screen" />

I'm obviously missing something basic. I'm 99% sure I should be able
to say something like:



I have looked around for a solution but everything seems to point to
the Site object (which requires a different entry in the database
which I want to avoid, development should be a near exact mirror of
production) or passing a variable through a view (these changes should
be global).

I'm new so please be gentle.

Thanks in advance,
Mark


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---