I have a package:
urls/
__init__.py
dev_urls.py
prod_urls.py
This urls
package is in an app api
and in my main urls.py
:
...
url(r'^api/v1/', include('apps.api.urls')),
...
I know that if I add this to urls.__init__.py
file:
# __init__.py
from dev_urls import *
Django will run including dev_urls.py
as apps.api.urls
.
But I'd like to make this dynamic by adding a variable in my settings module:
# settings
URLS_ENV = 'dev' # This could be 'prod'
Then in my urls.__init__.py
:
# __init__.py
from django.conf import settings
name = settings.URLS_ENV + '_urls'
Now, here is the question: How can I do somwthing like:
from <name> import *
Is this possible?