You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I ran into this problem with adding dbsettings to my app. I believe i'm doing it in a non-standard way and the dbsettings code is making some assumptions.
First here is the error I get when I try to load my settings page in the admin:
Traceback:
File "/Users/marco/www/apps/eig2010/src/django/django/core/handlers/base.py" in get_response
92. response = callback(request, *callback_args, **callback_kwargs)
File "/Users/marco/www/apps/eig2010/src/django/django/contrib/admin/views/decorators.py" in _checklogin
33. return view_func(request, *args, **kwargs)
File "/Users/marco/www/apps/eig2010/eig2010/dbsettings/views.py" in app_settings
16. settings = loading.get_app_settings(app_label)
File "/Users/marco/www/apps/eig2010/eig2010/dbsettings/loading.py" in get_app_settings
38. return [p for p in _settings if app_label == p.module_name.split('.')[-2]]
Exception Type: IndexError at /admin/settings/eigsite/
Exception Value: list index out of range
The problem is with the splitting and taking the second to last item from the module_name. I did some print and the module name is only the name of the app, i.e. "eigsite". I didn't fully trace the code here, but I see two possible reasons for this.
I have my django project on my python path so when I add apps to INSTALLED_APPS I don't have to prefix them with the project name. So I added "eigsite" instead of "eig2010.eigsite". It's unlikely that this is the issue because you're looking up the module name from the dynamically and don't seem to be looking in INSTALLED_APPS
The more likely cause is that I'm adding my settings in the top level app instead of in a submodule like models.py. So this is in my eigsite/init.py
So basically my settings are at "eigsite.app_settings" instead of "eigsite.models.app_settings". I have a patch for this but it's pretty simplistic. It just checks the length of module_name.split('.') and if it's less than 2 just turns the first item. I'm sure you'll have a more appropriate fix in mind.
The text was updated successfully, but these errors were encountered:
I actually didn't see in the README specifically how to add settings at an app level (which is exactly what I need). I really need this setting. Is it possible for this to be a priority?
I ran into this problem with adding dbsettings to my app. I believe i'm doing it in a non-standard way and the dbsettings code is making some assumptions.
First here is the error I get when I try to load my settings page in the admin:
The problem is with the splitting and taking the second to last item from the module_name. I did some print and the module name is only the name of the app, i.e. "eigsite". I didn't fully trace the code here, but I see two possible reasons for this.
I have my django project on my python path so when I add apps to INSTALLED_APPS I don't have to prefix them with the project name. So I added "eigsite" instead of "eig2010.eigsite". It's unlikely that this is the issue because you're looking up the module name from the dynamically and don't seem to be looking in INSTALLED_APPS
The more likely cause is that I'm adding my settings in the top level app instead of in a submodule like models.py. So this is in my eigsite/init.py
So basically my settings are at
"eigsite.app_settings"
instead of"eigsite.models.app_settings"
. I have a patch for this but it's pretty simplistic. It just checks the length of module_name.split('.') and if it's less than 2 just turns the first item. I'm sure you'll have a more appropriate fix in mind.The text was updated successfully, but these errors were encountered: