Skip to content

Commit

Permalink
Merge pull request #95 from innogames/automatic_urls_include_bugfix
Browse files Browse the repository at this point in the history
fix: Skip app if urls module does not exist
  • Loading branch information
kofrezo committed May 26, 2020
2 parents cecdcb8 + da8172f commit e7c86dc
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions serveradmin/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@
for app in apps.get_app_configs():
name = app.name
module_spec = find_spec(name + '.urls')
if module_spec is not None:
module = module_spec.loader.load_module()
if module_spec is None:
continue

module = module_spec.loader.load_module()

if name.startswith('serveradmin.') or name.startswith('serveradmin_'):
urlpatterns.append(url(
r'^{}/'.format(name[(len('serveradmin') + 1):]), include(module)
))
url_path = name[(len('serveradmin') + 1):]
urlpatterns.append(url(r'^{}/'.format(url_path), include(module)))
elif name == 'igrestlogin':
urlpatterns.append(url(r'^loginapi/', include(module)))

Expand Down

0 comments on commit e7c86dc

Please sign in to comment.