Python Forum
Error while creating new Creating Models on Django
Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error while creating new Creating Models on Django
#1
Hello Foks,
i am not able to run my python server, i am getting this error, please assist me.
Thank you
Manam'
Quote:C:\Project\My1stDJangoSite>python manage.py runserver
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x00000062AC407158>
Traceback (most recent call last):
File "C:\Python\lib\site-packages\django-2.1b1-py3.6.egg\django\utils\autoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "C:\Python\lib\site-packages\django-2.1b1-py3.6.egg\django\core\management\commands\runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "C:\Python\lib\site-packages\django-2.1b1-py3.6.egg\django\utils\autoreload.py", line 248, in raise_last_exception
raise _exception[1]
File "C:\Python\lib\site-packages\django-2.1b1-py3.6.egg\django\core\management\__init__.py", line 337, in execute
autoreload.check_errors(django.setup)()
File "C:\Python\lib\site-packages\django-2.1b1-py3.6.egg\django\utils\autoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "C:\Python\lib\site-packages\django-2.1b1-py3.6.egg\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Python\lib\site-packages\django-2.1b1-py3.6.egg\django\apps\registry.py", line 112, in populate
app_config.import_models()
File "C:\Python\lib\site-packages\django-2.1b1-py3.6.egg\django\apps\config.py", line 198, in import_models
self.models_module = import_module(models_module_name)
File "C:\Python\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Project\My1stDJangoSite\AboutUs\models.py", line 5, in <module>
class Album(models.Model):
File "C:\Project\My1stDJangoSite\AboutUs\models.py", line 11, in Album
class Song(models.model):
AttributeError: module 'django.db.models' has no attribute 'model'

models.py
Quote:from django.db import models


# Create your models here.

class Album(models.Model):
artist = models.CharField(max_length=250)
album_title = models.CharField(max_length=500)
genre = models.CharField(max_length=100)
album_logo = models.CharField(max_length=1000)


class Song(models.Model):
album = models.ForeignKey(Album, on_delete=models.CASCADE)
file_type = models.CharField(max_length=10)
song_title = models.CharField(max_length=250)

settings.py
Quote:# Application definition

INSTALLED_APPS = [
'AboutUs.apps.AboutusConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
Reply
#2
have you run ./manage.py check (from directory where manage.py is located)?
if not, do so it will show where the model problems are located.
Reply
#3
Thanks Larz60,
i had to redo it, and it works, i had to create new package and apps.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Error - ManyToMany Fields in Django rob25111 0 71 Jan-17-2021, 04:58 PM
Last Post: rob25111
  creating an exe file for a python django project Sanjish 0 170 Dec-27-2020, 07:33 AM
Last Post: Sanjish
  Creating a RESTful web service and web service client dangermaus33 0 152 Dec-01-2020, 09:56 PM
Last Post: dangermaus33
  Best module for creating a web based form? t4keheart 12 739 Aug-06-2020, 02:02 PM
Last Post: snippsat
  Creating tables with pymysql using Xampp newbie1 0 935 Jul-15-2020, 11:10 AM
Last Post: newbie1
  Creating Python dataframes using a County Jail Daily Booking Register (Snohomish, WA) BrandonKastning 3 584 Mar-25-2020, 08:36 PM
Last Post: BrandonKastning
  Django - Am I in the right direction for creating the models of my Phone Review appli shawnmichaels583583 0 430 Oct-15-2019, 06:25 AM
Last Post: shawnmichaels583583
  creating a range of unique & sequential ID's in a database while handling concurency jertel 0 425 Sep-19-2019, 02:41 PM
Last Post: jertel
  Posting html values to views/models in Django Malt 1 667 Sep-04-2019, 01:44 PM
Last Post: fishhook
  upload big file in Django with process bar and i get error : MemoryError ma_norouzifar 3 1,587 Aug-06-2019, 06:57 AM
Last Post: fishhook

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020