python - django admin error - cannot access admin page -
i started new django 1.8 project. created superuser , went 127.0.0.1:8000/admin/ , logged in that. after logging in, shows following error:
(1054, "unknown column 'django_content_type.name' in 'field list'") i searched around , found 1 relevant question, here.
as said in discussion there, dropped schema , recreated many times; still same error. django_content_type table in database has 3 fields: id, app_label , model. doesn't have 'name' deprecated.
also, can access other urls /admin/auth/, /admin/auth/users/, trying add more users gives following error(i think coming due same problem above):
error creating new content types. please make sure contenttypes migrated before trying migrate apps individually. i'm new django in general. appreciated. thanks.
here's full error:
operationalerror @ /admin/ (1054, "unknown column 'django_content_type.name' in 'field list'") request method: request url: http://127.0.0.1:8000/admin/ django version: 1.7.5 exception type: operationalerror exception value: (1054, "unknown column 'django_content_type.name' in 'field list'") exception location: /usr/local/lib/python2.7/dist-packages/mysqldb/connections.py in defaulterrorhandler, line 36 python executable: /usr/bin/python python version: 2.7.6 python path: ['/home/rahul/development/rmgl_project', '/usr/local/lib/python2.7/dist-packages/virtualenv-12.1.1-py2.7.egg', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/pilcompat', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7', '/usr/lib/python2.7/dist-packages/ubuntu-sso-client'] server time: wed, 8 jul 2015 07:19:12 +0000 i realised error shows django version 1.7 whereas installed django 1.8 using pip. ran python manage.py shell , checked django version there(cannot post screenshot, rep not high enough).
$ python manage.py shell >>> import django >>> django.version (1, 8, 2, 'final', 0) >>> how can correct this? again. i'm using virtualenv.
edit: adding urls.py
"""rmgl_project url configuration `urlpatterns` list routes urls views. more information please see: https://docs.djangoproject.com/en/1.8/topics/http/urls/ examples: function views 1. add import: my_app import views 2. add url urlpatterns: url(r'^$', views.home, name='home') class-based views 1. add import: other_app.views import home 2. add url urlpatterns: url(r'^$', home.as_view(), name='home') including urlconf 1. add import: blog import urls blog_urls 2. add url urlpatterns: url(r'^blog/', include(blog_urls)) """ django.conf.urls import include, url django.contrib import admin urlpatterns = [ url(r'^admin/', include(admin.site.urls)), ] adding manage.py:
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("django_settings_module", "rmgl_project.settings") django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
the problem virtualenv - not enabled.
in order check version of django (and path module), add following lines ./manage.py file:
print(__import__('django')) # should print module information print(__import__('django').__file__) # should print location of __init__.py file right after if __name__ == '__main__' line.
Comments
Post a Comment