I have a django application, with a module called “app”
Now this module has a file called “urls.py” which has a variable called “HOME_URL“
What I’m trying to do ?
app_label = "app"
url = __import__(app_label).urls.HOME_URL
print url
That obviously doesn’t work, but I hope you got what I’m trying to do, If not please comment I will edit the question to contain more info.
You can use
import_moduleto load a module relative to the root of a django project.This should work within your django project, or in
./manage.py shell.