Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Login page does not exist (500 Internal Service Error) #44

Closed
MatthewRalston opened this issue Sep 1, 2015 · 4 comments
Closed

Login page does not exist (500 Internal Service Error) #44

MatthewRalston opened this issue Sep 1, 2015 · 4 comments

Comments

@MatthewRalston
Copy link

Hello everyone. I have a fresh production install of cloudlaunch on RHEL6 configured with PostgreSQL and Nginx, following the README. When I access "my-server:portnum/admin" page, I receive a 500 error indicating that the login.html page could not be found.

Django error

Environment:


Request Method: GET
Request URL: http://localhost:8000/admin/

Django Version: 1.3
Python Version: 2.7.8
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.admin',
 'django.contrib.admindocs',
 'south',
 'bootstrap_toolkit',
 'biocloudcentral',
 'djcelery',
 'kombu.transport.django']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware')

Template Loader Error:
Django tried loading these templates, in this order:
Using loader django.template.loaders.filesystem.Loader:
/srv/cloudlaunch/cloudlaunch/templates/admin/login.html (File does not exist)
Using loader django.template.loaders.app_directories.Loader:
/home/ralstonm/.pyenv/versions/cloudlaunch/lib/python2.7/site-packages/bootstrap_toolkit/templates/admin/login.html (File does not exist)



Traceback:
File "/home/ralstonm/.pyenv/versions/cloudlaunch/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  111.                         response = callback(request, *callback_args, **callback_kwargs)
File "/home/ralstonm/.pyenv/versions/cloudlaunch/lib/python2.7/site-packages/django/contrib/admin/sites.py" in wrapper
  214.                 return self.admin_view(view, cacheable)(*args, **kwargs)
File "/home/ralstonm/.pyenv/versions/cloudlaunch/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapped_view
  93.                     response = view_func(request, *args, **kwargs)
File "/home/ralstonm/.pyenv/versions/cloudlaunch/lib/python2.7/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
  79.         response = view_func(request, *args, **kwargs)
File "/home/ralstonm/.pyenv/versions/cloudlaunch/lib/python2.7/site-packages/django/contrib/admin/sites.py" in inner
  196.                 return self.login(request)
File "/home/ralstonm/.pyenv/versions/cloudlaunch/lib/python2.7/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
  79.         response = view_func(request, *args, **kwargs)
File "/home/ralstonm/.pyenv/versions/cloudlaunch/lib/python2.7/site-packages/django/contrib/admin/sites.py" in login
  331.         return login(request, **defaults)
File "/home/ralstonm/.pyenv/versions/cloudlaunch/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapped_view
  93.                     response = view_func(request, *args, **kwargs)
File "/home/ralstonm/.pyenv/versions/cloudlaunch/lib/python2.7/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
  79.         response = view_func(request, *args, **kwargs)
File "/home/ralstonm/.pyenv/versions/cloudlaunch/lib/python2.7/site-packages/django/contrib/auth/views.py" in login
  69.                               context_instance=RequestContext(request, current_app=current_app))
File "/home/ralstonm/.pyenv/versions/cloudlaunch/lib/python2.7/site-packages/django/shortcuts/__init__.py" in render_to_response
  20.     return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)
File "/home/ralstonm/.pyenv/versions/cloudlaunch/lib/python2.7/site-packages/django/template/loader.py" in render_to_string
  181.         t = get_template(template_name)
File "/home/ralstonm/.pyenv/versions/cloudlaunch/lib/python2.7/site-packages/django/template/loader.py" in get_template
  157.     template, origin = find_template(template_name)
File "/home/ralstonm/.pyenv/versions/cloudlaunch/lib/python2.7/site-packages/django/template/loader.py" in find_template
  138.     raise TemplateDoesNotExist(name)

Exception Type: TemplateDoesNotExist at /admin/
Exception Value: admin/login.html

Contents of django bootstrap_toolkit (no admin directory):

>/bin/ls ~/.pyenv/versions/cloudlaunch/lib/python2.7/site-packages/bootstrap_toolkit/templates
bootstrap_toolkit
>/bin/ls ~/.pyenv/versions/cloudlaunch/lib/python2.7/site-packages/bootstrap_toolkit/templates/*
field_checkbox.html  field_errors.html      field.html             field_search.html    form.html      nav.html       pagination.html
field_choices.html   field_help.html        field_inline.html          field_vertical.html  formset.html   non_field_error.html   pills.html
field_default.html   field_horizontal.html  field_prepend_append.html  field_visible.html   messages.html  non_field_errors.html  tabs.html
>pip freeze
/srv/cloudlaunch/cloudlaunch >pip freeze
amqp==1.0.12
anyjson==0.3.3
billiard==2.7.3.31
bioblend==0.6.1
boto==2.38.0
celery==3.0.21
dj-database-url==0.2.1
Django==1.3
django-bootstrap-toolkit==2.12.0
django-celery==3.0.17
gunicorn==19.3.0
honcho==0.6.6
Jinja2==2.7
kombu==2.5.12
MarkupSafe==0.18
meld3==1.0.2
mock==1.0.1
nose==1.3.0
poster==0.8.1
psycopg2==2.4.2
python-dateutil==2.1
python-memcached==1.48
pytz==2013b0
PyYAML==3.10
requests==1.2.3
requests-toolbelt==0.4.0
simplejson==3.3.0
six==1.9.0
South==0.7.3
supervisor==3.1.3
wheel==0.24.0
@afgane
Copy link
Contributor

afgane commented Sep 1, 2015

I cannot reproduce this and searching for the exception doesn't seem to lead anywhere either.
Django Admin (including index.html) is located under Django's contrib dir (/srv/cloudlaunch/.cl/lib/python2.7/site-packages/django/contrib/admin/templates).

The only thing I noticed is that your venv is in ~/.pyenv. So did you change paths in Procfile* and supervisor confs to reflect that because the instructions and consequently those scripts are currently hard coded to use the virtualenv from /srv/cloudlaunch/.cl?

@MatthewRalston
Copy link
Author

The virtualenv, courtesy of pyenv-virtualenv, is located in ~/.pyenv/versions and is called cloudlaunch. Then I simply symlinked /srv/cloudlaunch/.cl to the virtualenv directory. I do not see the templates directory in the django/contrib/admin directory.
If I understand correctly, django searches for an application specific login template at a path relative to the root of the application (/srv/cloudlaunch/cloudlaunch/templates/admin/login.html). If this does not exist, it checks for a templates through the following, which makes user of the TEMPLATE_DIRS/DIRS variable in settings.py:
Using loader django.template.loaders.app_directories.Loader
/home/ralstonm/.pyenv/versions/cloudlaunch/lib/python2.7/site-packages/bootstrap_toolkit/templates/admin/login.html (File does not exist)

I'm not sure why your django installation contains these templates... Can you confirm that my pypy packages are correct from the pip freeze above?

/srv/cloudlaunch >/bin/ls .cl/lib/python2.7/site-packages/django/contrib/admin/
actions.py   filterspecs.py   forms.py   helpers.py   __init__.py   models.py   options.py   sites.py   templatetags  util.pyc       validation.pyc  widgets.py
actions.pyc  filterspecs.pyc  forms.pyc  helpers.pyc  __init__.pyc  models.pyc  options.pyc  sites.pyc  util.py       validation.py  views       widgets.pyc

@afgane
Copy link
Contributor

afgane commented Sep 1, 2015

This is the output from my pip freeze:

amqp==1.0.12
anyjson==0.3.3
argparse==1.2.1
billiard==2.7.3.31
bioblend==0.7.0-dev
boto==2.38.0
celery==3.0.21
Django==1.3
django-bootstrap-toolkit==2.12.0
django-celery==3.0.17
dj-database-url==0.2.1
gunicorn==17.5
honcho==0.6.6
Jinja2==2.7
kombu==2.5.12
MarkupSafe==0.18
mock==1.0.1
nose==1.3.0
poster==0.8.1
psycopg2==2.4.2
python-dateutil==2.1
python-memcached==1.48
pytz==2013b
PyYAML==3.11
requests==2.7.0
requests-toolbelt==0.4.0
simplejson==3.3.0
six==1.9.0
South==0.7.3
wsgiref==0.1.2

There are differences with argparse, gunicorn, meld3, requests but none of those seem related.

If you’re missing dirs under the Django installation path, perhaps try reinstalling Django?

@MatthewRalston
Copy link
Author

Yes. I uninstalled the django version installed via pip, downloaded source, and ran setup.py. This produced the correct directory structure reflecting the release 1.3.7 for Django on github. This solved my problem. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants