page not found errors for most urls but main landing page displaying okay

49 views
Skip to first unread message

Lee

unread,
Jun 25, 2014, 3:08:35 PM6/25/14
to django...@googlegroups.com
I have copied a Django project to my web server from a repo and am getting the correct initial landing page for the website with the right styling when I go to the main URL. Most other urls give "page not found" errors. This includes the divs that are called on to make menus on the main page so the "Page not found" error is printing over the main landing page.

I'm not sure where to start with diagnosis - any thoughts would be appreciated.

I have checked the urls.py file and have tried to go directly to the URLs listed starting with http://mysite.org/project/ ...

urlpatterns = patterns('',
# index.html gives a page not found error
 url(r'^$', 'project.views.index', name='index'),


# These go to an unstyled page with correct text
    url(r'^signup/$', 'project.views.signUp', name='signup'),
        url(r'^login/$', 'project.views.login', name='login'),
        url(r'^logout/$', 'project.views.logout', name='logout'),


# These also give a page not found error

url(r'^$', 'project.views.index', name='index'),
url(r'^map/nav/$', 'project.views.mapNavigation', name='mav_nav'),
url(r'^interview/new/$', 'project.views.interviewSelect', name='interview_select'),
url(r'^interview/player/$', 'project.views.interviewPlayer', name='interview_player'),
url(r'^interview/retailer/$', 'project.views.interviewRetailer', name='interview_retailer'),
url(r'^popup/(?P<layer>.+)/(?P<neighborhood>.+)/(?P<perin>.+)/(?P<dol>.+)/(?P<sale>.+)/(?P<win>.+)/(?P<income>.+)/(?P<netwin>.+)/(?P<id>.+)/$','project.views.popup',name='popup'),


Lee

Michael Lind Hjulskov

unread,
Jun 25, 2014, 3:36:52 PM6/25/14
to django...@googlegroups.com
Hi

I had the exact same problem a few days ago. It was one of my templates that suddenntly was emty. very spooky
Or maybe you have an "extends" somewhere that is not correct
I would debug by looking in the relevant view and see which template is called, and the simplify that template to test if bug is in templates or elsewhere

Michael

Lee

unread,
Jun 25, 2014, 5:53:21 PM6/25/14
to django...@googlegroups.com
Thanks - it must be a problem with the site accessing templates but I can't figure it out. This django project works on another server but I have copied it to a shared host webserver  (Bluehost) and am running it with fcgi so maybe the problem is in the setup.

I am focusing on one url and template, but all have the same problem except the main landing page, which does work.

The url http://mysite/project/map/nav/ shows the right text without any styling
This is the url pattern for this page in urls.py.
url(r'^map/nav/$', 'citi_digits.views.mapNavigation', name='mav_nav'),

The view for this url references the template:
def mapNavigation(request):
    """
Loads the map navigation elements
"""
    #get all classes
    #get classes
    classes = Teacher.objects.values_list('className', flat=True)
    return render_to_response('map_navigation.html',{'classes':classes},context_instance=RequestContext(request))

In the settings.py the setting for templates is:
TEMPLATE_DIRS = (
    os.path.join(PROJECT_ROOT, '..', 'citi_digits','templates'),

I also tried an absolute path and put the templates in www but this did not work.

My static settings are:

STATIC_ROOT = '/home5/user/public_html/project/static/'
STATIC_URL = 'http://mysite.org/project/static/'

Lee

Kelvin Wong

unread,
Jun 25, 2014, 11:51:58 PM6/25/14
to django...@googlegroups.com
If you have access to your logs, check your logs to figure out where those requests are going.

You can also SSH into the server and temporarily turn on the DEBUG=True, TEMPLATE_DEBUG=True and let Django tell you what is going on.

Without seeing your fcgi script, my guess is that it is Apache not mapping the request to your WSGI file/fcgi script. Double check your htaccess file mod_rewrite directives.

K

Vijay Khemlani

unread,
Jun 26, 2014, 10:35:03 AM6/26/14
to django...@googlegroups.com
Is it possible that the app is getting confused because it is not running at the root of the domain (/) but instead on a subdirectory (/project/)?


--
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2de669cf-c2cd-4013-b1ad-f54e73b5e933%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Lee

unread,
Jul 1, 2014, 2:46:45 PM7/1/14
to django...@googlegroups.com
Thank you everyone. I solved the problem. It was a relative vs absolute url issue. There was a line in the static/js/applications.js file that had to be changed:
RELATIVE_URL = '/myproject';  //for development leave this blank. For production it should be '/myproject'

This was hard to debug because I'm doing this on a shared host and don't have access to the Apache logs - it was hard to figure out where the URLs were going. Also this is a project developed by someone else so I did not know about this setting in the js.

L
Reply all
Reply to author
Forward
0 new messages