Python Forum

Full Version: Error while creating new Creating Models on Django
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.