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
Hello Foks,
i am not able to run my python server, i am getting this error, please assist me.
Thank you
Quote:C:\Project\My1stDJangoSite>python 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\", line 225, in wrapper
fn(*args, **kwargs)
File "C:\Python\lib\site-packages\django-2.1b1-py3.6.egg\django\core\management\commands\", line 109, in inner_run
File "C:\Python\lib\site-packages\django-2.1b1-py3.6.egg\django\utils\", line 248, in raise_last_exception
raise _exception[1]
File "C:\Python\lib\site-packages\django-2.1b1-py3.6.egg\django\core\management\", line 337, in execute
File "C:\Python\lib\site-packages\django-2.1b1-py3.6.egg\django\utils\", line 225, in wrapper
fn(*args, **kwargs)
File "C:\Python\lib\site-packages\django-2.1b1-py3.6.egg\django\", line 24, in setup
File "C:\Python\lib\site-packages\django-2.1b1-py3.6.egg\django\apps\", line 112, in populate
File "C:\Python\lib\site-packages\django-2.1b1-py3.6.egg\django\apps\", line 198, in import_models
self.models_module = import_module(models_module_name)
File "C:\Python\lib\importlib\", 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\", line 5, in <module>
class Album(models.Model):
File "C:\Project\My1stDJangoSite\AboutUs\", line 11, in Album
class Song(models.model):
AttributeError: module 'django.db.models' has no attribute 'model'
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)
Quote:# Application definition

have you run ./ check (from directory where is located)?
if not, do so it will show where the model problems are located.
Thanks Larz60,
i had to redo it, and it works, i had to create new package and apps.

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

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