Problem with views when I try to move urls to a new app (folder)

16 views
Skip to first unread message

Uri Even-Chen

unread,
Dec 14, 2016, 9:32:54 AM12/14/16
to django...@googlegroups.com
Dear Django Users,

I'm trying to move the main view into a new main app (folder) inside speedy/mail. Currently the file urls.py is like this:

from django.conf import settings
from django.conf.urls import url, include
from . import views
from django.conf.urls.static import static
urlpatterns = [
url(r'^feedback/', include('speedy.net.feedback.urls', namespace='feedback')),
url(r'^', views.MainPageView.as_view(), name='main_page_view'),
]
if settings.DEBUG:
urlpatterns = static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) + urlpatterns
try:
import debug_toolbar
urlpatterns += [
url(r'^__debug__/', include(debug_toolbar.urls)),
]
except ImportError:
pass

Now I want to move the main page url & view to speedy/mail/main/urls.py and views.py. Now the urls.py is like this:

from django.conf import settings
from django.conf.urls import url, include
from django.conf.urls.static import static

urlpatterns = [
url(r'^feedback/', include('speedy.net.feedback.urls', namespace='feedback')),
url(r'', include('speedy.mail.main.urls', namespace='main')),
]

if settings.DEBUG:
urlpatterns = static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) + urlpatterns

try:
import debug_toolbar
urlpatterns += [
url(r'^__debug__/', include(debug_toolbar.urls)),
]
except ImportError:
pass

And speedy/mail/main/urls.py is like this:

from django.conf.urls import url

from . import views

urlpatterns = [
url(r'', views.MainPageView.as_view(), name='main_page_view'),
]

But the problem is it doesn't work, I get this error message:

DoesNotExist at /

Site matching query does not exist.
I also tried with r'^' instead of r'' but it still doesn't work. What did I do wrong?

Thanks,
Uri.

Uri Even-Chen  
photo Phone: +972-54-3995700
Email: u...@speedy.net
Website: http://www.speedysoftware.com/uri/en/
    

Uri Even-Chen

unread,
Dec 14, 2016, 10:02:50 AM12/14/16
to django...@googlegroups.com
Hi,

I found the problem, I had a problem with the local database. Now it works.

Thanks,
Uri.


Uri Even-Chen  
photo Phone: +972-54-3995700
Email: u...@speedy.net
Website: http://www.speedysoftware.com/uri/en/
    

GMail

unread,
Dec 14, 2016, 10:03:42 AM12/14/16
to django...@googlegroups.com
Hi! It looks like the problem is with Site query, not urlconf. Do you use django.contrib.sites? If so, check SITE_ID variable in your django settings, it probably contains non-existant Site id.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMQ2MsGcTG1%3D%3D7z1z1Y1F9r-d6PggJeYJD63%3DzQe%3DDU%3DhSNW9A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages