Python Forum
Error while creating new Creating Models on Django - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html)
+--- Thread: Error while creating new Creating Models on Django (/thread-11497.html)



Error while creating new Creating Models on Django - aniyanetworks - Jul-11-2018

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',
]



RE: Error while creating new Creating Models on Django - Larz60+ - Jul-11-2018

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.


RE: Error while creating new Creating Models on Django - aniyanetworks - Jul-13-2018

Thanks Larz60,
i had to redo it, and it works, i had to create new package and apps.