Categories
Mastering Development

django cannot access default admin section

I am trying to access the django default admin section and I get a 404 error “not found” I can access the default django splash page that tells me I am in debugging mode If I try to access via nginx, I get a nginx bases 404 error ‘not found’ in browser but my logs […]

Categories
User Help

OperationalError at /admin/products/product/add/ no such table: main.auth_user__old DJANGO [closed]

main.auth_user__old in django tutorial going through mosh created a web server.When saving some polls or products or set i get this error instead of going to be saved on the site. Heres 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: […]

Categories
Mastering Development

Allowing a user to only be able to edit their own info with a custom model in Django error

I am new to development and Django. This is my first project from scratch. I decided to go with a custom user model so I could customize the registration page and require users to submit a photo during registration. I am making a tinder clone and I wanted to make sure users submitted a photo. […]

Categories
Mastering Development

My Django admin panel gives server error(500) when DEBUG=False

“Error:-1” is show when my DEBUG=False and “Error:-2” is show when my DEBUG=True. I will use python 3.7.3 and django 3.0.4 . my settings.py file is:- DEBUG = False ALLOWED_HOSTS = [“*”] INSTALLED_APPS = [ ‘django.contrib.admin’, ‘django.contrib.auth’, ‘django.contrib.contenttypes’, ‘django.contrib.sessions’, ‘django.contrib.messages’, ‘django.contrib.staticfiles’, ‘home.apps.HomeConfig’, ] MIDDLEWARE = [ ‘django.middleware.security.SecurityMiddleware’, ‘whitenoise.middleware.WhiteNoiseMiddleware’, ‘django.contrib.sessions.middleware.SessionMiddleware’, ‘django.middleware.common.CommonMiddleware’, ‘django.middleware.csrf.CsrfViewMiddleware’, ‘django.contrib.auth.middleware.AuthenticationMiddleware’, ‘django.contrib.messages.middleware.MessageMiddleware’, ‘django.middleware.clickjacking.XFrameOptionsMiddleware’, ] […]

Categories
Mastering Development System & Network

408 status code on checking access logs of django on apache using mod_wsgi in windows

one is php site and other is django project. Php site is working fine but not django project.It is working fine on local runserver but not on apache.I have followed https://www.codementor.io/@aswinmurugesh/deploying-a-django-application-in-windows-with-apache-and-mod_wsgi-uhl2xq09e tutorial for deployment. httpd-vhosts.conf: <VirtualHost *:8086> ServerName localhost ServerAlias localhost DocumentRoot “${INSTALL_DIR}/www” <Directory “${INSTALL_DIR}/www/”> Options +Indexes +Includes +FollowSymLinks +MultiViews AllowOverride All Require all granted […]

Categories
Development System & Network

Error to run ./manage migrate_schema (django-tenant) in a virtual machine

I have a single django application hosted on AWS – Web client <=> nginx <=> uwsgi <=> django. I decided to transform It into a multi tenant with django-tenant. Also, I’m using django-celery-beat for scheduling tasks. My single application works normally on AWS and my multi tenant works locally too, in my machine. I had […]

Categories
Development

Viewing users in django admin

I extended my user model to create two profile types, a mentor profile and a student profile. However I am noticing that I cannot view any of my users in django.admin. I only see groups under authentication. Here is my admin.py file from django.contrib.auth import get_user_model from django.contrib import admin from django.contrib.auth.admin import UserAdmin from […]

Categories
Development

Django configuration issue

I am new to django and familiarizing it. I have installed django and able to run the server and access the django home page. But when I add the model class I am getting the following error in terminal. RuntimeError: Model class myproject.urls.Board doesn’t declare an explicit app_label and isn’t in an application in INSTALLED_APPS. […]

Categories
Development

Why is the error occur when trying to chang language in django settings.py?

import os #added to change LANGUAGES from django.utils.translation import ugettext_lazy as _ #added to change LANGUAGES LANGUAGES = [ (‘ko’, _(‘Korean’)), (‘en’, _(‘English’)), ] # Build paths inside the project like this: os.path.join(BASE_DIR, …) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Quick-start development settings – unsuitable for production # See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key […]

Categories
Development

Custom model form on admin tabular inline gives Integrity Error

I have made a custom model form so that I can change the header text: forms.py class AddRoomAddRoomExtrasForm(ModelForm): roomextrafields = forms.ModelChoiceField(queryset=RoomExtra.objects.all(), label=_(‘Room Extras’)) class Meta: model = RoomExtra fields = (‘roomextrafields’, ) admin.py class RoomExtraInLine(admin.TabularInline): model = Room.roomextra.through extra = 1 verbose_name = _(‘extra’) verbose_name_plural = _(‘extras’) form = AddRoomAddRoomExtrasForm class RoomAdmin(admin.ModelAdmin): model = Room […]