Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Trying to setup django to take subdomains and use different settings file based on subdomain

dns is setup as wildcards

apache mod_vhost_alias sounded like good option, it did not work

SetEnv DJANGO_SETTINGS_MODULE site.settings.%1

gets this error

ImportError: Could not import settings 'site.settings.%1'

can mod_vhost_alias be made to work somehow? can rewrite module be used to pass along subdomain to django settings? is there any other way to pick up different settings files based on subdomain

share|improve this question

1 Answer 1

mod_rewrite's RewriteRule has a flag, E, that sets an environment variable. You could probably have a RewriteRule that matches everything and sets E=DJANGO_SETTINGS_MODULE:%{SERVER_NAME)

%0, %1 etc. from mod_vhost_alias only works in its own settings such as VirtualScriptAlias etc.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.