Django: Error while installing "Django Registration Redux" - django

I am trying to install "Django Registration Redux".
I followed every step in the official website to install.
When I am installing django.contrib.sites, the admin doesn't work, and when I comment this the admin starts working but registration does not work in either way.
It gives the error as:
DoesNotExist at /accounts/login/
Site matching query does not exist.
Request Method: GET
Request URL: http://127.0.0.1:8000/accounts/login/
Django Version: 1.9
Exception Type: DoesNotExist
Exception Value:
Site matching query does not exist.
Exception Location: c:\Python27\lib\site-packages\django\db\models\query.py in get, line 387
Python Executable: c:\Python27\python.exe
Python Version: 2.7.11
Python Path:
['E:\\myproject\\mysite',
'C:\\Windows\\SYSTEM32\\python27.zip',
'c:\\Python27\\DLLs',
'c:\\Python27\\lib',
'c:\\Python27\\lib\\plat-win',
'c:\\Python27\\lib\\lib-tk',
'c:\\Python27',
'c:\\Python27\\lib\\site-packages']
Server time: Tue, 24 May 2016 13:26:56 +0000

It sounds like you haven't followed the instructions to enable the sites framework.
After adding django.contrib.sites to INSTALLED_APPS, you need to set SITE_ID = 1 in your settings, then run the migrate command.

Related

Deployed django app error: Relation does not exist

I deployed a django app using a postresql database with Heroku.
The app works perfectly on my local machine but when I want to create a user or to login using the deployed app, I run into the following error:
ProgrammingError at /register/
relation "register_user" does not exist
LINE 1: SELECT (1) AS "a" FROM "register_user" WHERE "register_user"...
^
Request Method: POST
Request URL: https://the-gecko.herokuapp.com/register/
Django Version: 4.0.3
Exception Type: ProgrammingError
Exception Value:
relation "register_user" does not exist
LINE 1: SELECT (1) AS "a" FROM "register_user" WHERE "register_user"...
^
Exception Location: /app/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py, line 89, in _execute
Python Executable: /app/.heroku/python/bin/python
Python Version: 3.9.10
Python Path:
['/app/.heroku/python/bin',
'/app',
'/app/.heroku/python/lib/python39.zip',
'/app/.heroku/python/lib/python3.9',
'/app/.heroku/python/lib/python3.9/lib-dynload',
'/app/.heroku/python/lib/python3.9/site-packages']
Server time: Mon, 21 Mar 2022 19:59:58 +0000
I believe this error has something do to with my postgres database, but I don't know what relevant code to share in that case.
Please, let me know if you have any idea how to solve that issue.

Failed to add a object in a app in the admin panel of Django

I am just a beginner in Django Web Development.Following a tutorial I tried to add a object on a app by admin in Django. This is a screenshot before adding object. After clicking Save button I got the error.
OperationalError at /admin/products/product/add/
no such table: main.auth_user__old
Request Method: POST
Request URL: http://127.0.0.1:8000/admin/products/product/add/
Django Version: 2.1
Exception Type: OperationalError
Exception Value:
no such table: main.auth_user__old
Exception Location: C:\Users\royal\AppData\Local\Programs\Python\Python38-32\lib\site-
packages\django\db\backends\sqlite3\base.py in execute, line 296
Python Executable: C:\Users\royal\AppData\Local\Programs\Python\Python38-32\python.exe
Python Version: 3.8.2
Python Path:
['C:\\Users\\royal\\PycharmProjects\\PyShop',
'C:\\Users\\royal\\AppData\\Local\\Programs\\Python\\Python38-32\\python38.zip',
'C:\\Users\\royal\\AppData\\Local\\Programs\\Python\\Python38-32\\DLLs',
'C:\\Users\\royal\\AppData\\Local\\Programs\\Python\\Python38-32\\lib',
'C:\\Users\\royal\\AppData\\Local\\Programs\\Python\\Python38-32',
'C:\\Users\\royal\\AppData\\Local\\Programs\\Python\\Python38-32\\lib\\site-packages',
'C:\\Users\\royal\\AppData\\Local\\Programs\\Python\\Python38-32\\lib\\site-packages\\win32',
'C:\\Users\\royal\\AppData\\Local\\Programs\\Python\\Python38-32\\lib\\site-packages\\win32\\lib',
'C:\\Users\\royal\\AppData\\Local\\Programs\\Python\\Python38-32\\lib\\site-packages\\Pythonwin']
Server time: Tue, 24 Mar 2020 15:59:31 +0000
I'm completely new in this sector.Help me to get rid off this error.

getting error when trying to add object in django admin

error page
Trace:
OperationalError at /admin/jobs/job/add/
no such table: main.auth_user__old
Request Method: POST
Request URL: http://127.0.0.1:8000/admin/jobs/job/add/
Django Version: 2.0.2
Exception Type: OperationalError
Exception Value:
no such table: main.auth_user__old
Exception Location: C:\Users\codering\Desktop\myenv\lib\site-packages\django\db\backends\sqlite3\base.py in execute, line 303
Python Executable: C:\Users\codering\Desktop\myenv\Scripts\python.exe
Python Version: 3.8.0
Python Path:
['C:\\Users\\codering\\Desktop\\portfolio',
'C:\\Users\\codering\\Desktop\\myenv\\Scripts\\python38.zip',
'C:\\Users\\codering\\Desktop\\myenv\\DLLs',
'C:\\Users\\codering\\Desktop\\myenv\\lib',
'C:\\Users\\codering\\Desktop\\myenv\\Scripts',
'c:\\users\\codering\\appdata\\local\\programs\\python\\python38\\Lib',
'c:\\users\\codering\\appdata\\local\\programs\\python\\python38\\DLLs',
'C:\\Users\\codering\\Desktop\\myenv',
'C:\\Users\\codering\\Desktop\\myenv\\lib\\site-packages']
Server time: Wed, 20 Nov 2019 10:45:27 +0000
This page is opening when i am trying to add an object, can anyone help?
Try running
python manage.py makemigrations
python manage.py migrate
From command line

i have two projects in django i can not open admin site for my second project,but i can open for my first project,can any one help me

AttributeError at /admin/
'WSGIRequest' object has no attribute 'user'
Request Method: GET
Request URL: http://127.0.0.1:8000/admin/
Django Version: 2.0.2
Exception Type: AttributeError
Exception Value:
'WSGIRequest' object has no attribute 'user'
Exception Location: C:\Users\vaaz\Desktop\venv\lib\site-packages\django\contrib\admin\sites.py in has_permission, line 186
Python Executable: C:\Users\vaaz\Desktop\venv\Scripts\python.exe
Python Version: 3.4.3
Python Path:
['C:\Users\vaaz\website1',
'C:\Windows\system32\python34.zip',
'C:\Users\vaaz\Desktop\venv\DLLs',
'C:\Users\vaaz\Desktop\venv\lib',
'C:\Users\vaaz\Desktop\venv\Scripts',
'C:\Python34\Lib',
'C:\Python34\DLLs',
'C:\Users\vaaz\Desktop\venv',
'C:\Users\vaaz\Desktop\venv\lib\site-packages']
Server time: Mon, 12 Mar 2018 10:21:49 +0000
This looks similar to this post
with your limited error description I can only suggest a few things that were mentioned in the above post:
Older Django versions use MIDDLEWARE_CLASSES = (...) in the settings.py rather than MIDDLEWARE = (...) try changing that variable.
If you are using virtualenv be sure to activate it before trying to runserver
If you created your app in a different version of Django and then installed it on another version it might give you errors.

No module named blog.urls

Recently found a django's blog
Install to own computer later
Run up appear this kind of mistake, how to solve?
No module named blog.urlsRequest Method: GET
Request URL: http://127.0.0.1:8000/
Django Version: 1.2.4
Exception Type: ImportError
Exception Value: No module named blog.urls
Exception Location: C:\Python25\Lib\site-packages\django\utils\importlib.py in import_module, line 35
Python Executable: C:\Python25\python.exe
Python Version: 2.5.1
Python Path: ['E:\\source\\DjangoBlog\\DjangoBlog', 'C:\\Python25\\lib\\site-packages\\setuptools-0.6c7-py2.5.egg', 'C:\\Python25\\lib\\site-packages\\simplejson-2.0.9-py2.5.egg', 'E:\\source\\DjangoBlog\\DjangoBlog\\src', 'C:\\Python25', 'C:\\Python25\\DLLs', 'C:\\Python25\\lib', 'C:\\Python25\\lib\\lib-tk', 'C:\\Python25\\lib\\plat-win', 'C:\\Python25\\lib\\site-packages', 'C:\\WINDOWS\\system32\\python25.zip', 'D:\\ecliipse\\eclipse-java-helios-SR1-win32\\eclipse\\plugins\\org.python.pydev_1.6.3.2010100513\\PySrc', 'C:\\Python25\\lib\\site-packages\\PIL']
Server time: Fri, 25 Feb 2011 15:36:58 +0800
According to Python Path E:\source\DjangoBlog\DjangoBlog - DjangoBlog is directory where your project placed? Is where blog directory inside? if not try rename project directory to 'blog'