Reputation: 45
08:41 ~/myapk $ python manage.py makemigrations
Traceback (most recent call last):
File "/home/chaxim/myapk/manage.py", line 22, in <module>
main()
File "/home/chaxim/myapk/manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 419, in execute
_from_command_line
utility.execute()
File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 395, in execute
django.setup()
File "/usr/local/lib/python3.9/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python3.9/site-packages/django/apps/registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "/usr/local/lib/python3.9/site-packages/django/apps/config.py", line 228, in create
if not issubclass(app_config_class, AppConfig):
TypeError: issubclass() arg 1 must be a class
everytime i tried to make migrations it shows same thing, i even tried export DJANGO_SETTINGS_MODULE=yoursite.settings command but no result.
admin.py
from django.contrib import admin
from .models import profile
# Register your models here.
admin.site.register(profile)
apps.py
from django.apps import AppConfig
class ProfilesConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'profiles'
def ready(self):
import profiles.signals
models.py
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class profile(models.Model):
first_name = models.CharField(max_length=200, blank=True)
last_name = models.CharField(max_length=200, blank=True)
business_name = models.OneToOneField(User, on_delete=models.CASCADE)
phone_num = models.CharField(max_length=200, blank=True)
email = models.EmailField(max_length=200, blank=True)
country = models.CharField(max_length=200, blank=True)
state = models.CharField(max_length=200, blank=True)
#location =
follow_BNS = models.ManyToManyField(User,related_name='othe_BNS',blank=True)
D_p = models.ImageField(default='default.jpg',upload_to='profile_pic')
#slug = models.SlugField(unique=True, blank=True)
create = models.DateTimeField(auto_now=True)
update = models.DateTimeField(auto_now_add=True)
def __str__(self):
return f'{self.business_name},{self.phone_num}'
signals.py
from django.db.models.signals import post_save
from django.contrib.auth.models import User
from django.dispatch import receiver
from .models import profile
from django.conf import settings
settings.configure()
settings.configure()
@receiver(post_save, sender=User)
def post_save_create_profile(sender, instance, created, **kwargs):
print('sender', sender)
print('instance', instance)
if created:
profile.objects.created(user=instance)
settings
"""
Django settings for myapk project.
Generated by 'django-admin startproject' using Django 3.2.3.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""
from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-d*e6ejr7t^0a-9uwh70$789_vyrzwxgkapm-d4=pa_2vg0s_x6'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ['']
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'share',
'hitcount',
'post',
'profiles',
'location',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'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',
]
ROOT_URLCONF = 'myapk.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
# this is to load the html file from templates folder
'DIRS': [BASE_DIR/'template'],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'myapk.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
# Password validation
# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/3.2/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.2/howto/static-files/
STATIC_URL = '/static/'
# Default primary key field type
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
# default static files settings for PythonAnywhere.
# see https://help.pythonanywhere.com/pages/DjangoStaticFiles for more info
MEDIA_ROOT = '/home/chaxim/myapk/media'
MEDIA_URL = '/media/'
STATIC_ROOT = '/home/chaxim/myapk/static'
STATIC_URL = '/static/'
this is my code so far i haven't created any view yet nor urls, but I keep getting the error
i also tried running DJANGO_SETTINGS_MODULE=yoursite.settings command but nothing works
Upvotes: 0
Views: 254