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
  Python django view error ZeeKolachi 1 233 Mar-18-2024, 03:14 PM
Last Post: Sowmya
  Creating a Browser Extension using Python j49857 3 820 Feb-13-2024, 10:49 PM
Last Post: j49857
  Webapp for creating sheet music philipbergwerf 2 1,401 Aug-17-2023, 12:38 PM
Last Post: Gaurav_Kumar
Photo After using models.Model on my class Im getting 'ImproperlyConfigured' error Django khavro 1 2,150 Apr-05-2021, 03:11 PM
Last Post: SheeppOSU
  Error - ManyToMany Fields in Django rob25111 0 1,504 Jan-17-2021, 04:58 PM
Last Post: rob25111
  creating an exe file for a python django project Sanjish 0 2,586 Dec-27-2020, 07:33 AM
Last Post: Sanjish
  Creating a RESTful web service and web service client dangermaus33 0 1,257 Dec-01-2020, 09:56 PM
Last Post: dangermaus33
  Best module for creating a web based form? t4keheart 12 4,772 Aug-06-2020, 02:02 PM
Last Post: snippsat
  Creating tables with pymysql using Xampp newbie1 0 2,074 Jul-15-2020, 11:10 AM
Last Post: newbie1
  Creating Python dataframes using a County Jail Daily Booking Register (Snohomish, WA) BrandonKastning 3 2,183 Mar-25-2020, 08:36 PM
Last Post: BrandonKastning

Forum Jump:

User Panel Messages

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