[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Fab-user] Trouble using upload_template
From: |
Jeff Forcier |
Subject: |
Re: [Fab-user] Trouble using upload_template |
Date: |
Tue, 15 May 2012 08:20:32 -0700 |
On Tue, May 15, 2012 at 3:23 AM, Stuart Axon <address@hidden> wrote:
> Hello All,
>
> I'm having trouble getting upload_template working - pretty sure my template
> is incorrect, but finding example templates seems difficult.
I don't even recognize the ${} format you're using in the template,
actually, curious where you got it from :) You need to be using Python
2.x style string interpolation, e.g. %(env_key_name)s. See:
http://docs.python.org/release/2.6.8/library/stdtypes.html#string-formatting-operations
So for example, change:
'django.db.backends.${django_db_engine})'
to:
'django.db.backends.%(django_db_engine)s)'
Take care to remember the trailing 's' after the close-paren, it's
easy to overlook.
Best,
Jeff
>
>
> env.project_name='test'
> env.django_db_engine='postgresql_psycopg2'
> upload_template('conf/settings_local.py', '%s/project/settings_local.py' %
> env.project_dir, context=env
>
> The file uploads but no subsititution occurs. The template file looks like
> this:
>
> DATABASES = {
> 'default': {
> 'ENGINE': 'django.db.backends.${django_db_engine})', # Add
> 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
> 'NAME': '${project_name}', # Or path to
> database file if using sqlite3.
> 'USER': 'dbuser', # Not used with sqlite3.
> 'PASSWORD': 'dbuser123', # Not used with sqlite3.
> 'HOST': 'localhost',
> # Set to empty string for localhost. Not used with
> sqlite3.
> 'PORT': '', # Set to empty string for default.
> Not used with sqlite3.
> },
> }
>
>
> _______________________________________________
> Fab-user mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/fab-user
>
--
Jeff Forcier
Unix sysadmin; Python/Ruby engineer
http://bitprophet.org