Leave a Reply

268 Comments on "Django Tutorial for Beginners – 8 – Activating Models"

Notify of
avatar

Eric Warner
Guest
Eric Warner
1 year 11 months ago

Great tutorials! have gotten this far, but after entering "python manage.py makemigrations" get a long list of output, but the last message is "AttributeError 'django.db.models' has no attribute 'Charfield'. I used DB Browser for SQLite to look at the data base to confirm that none of the model attributes got written. There aren't any permission problems (based on properties). Has this happened to anyone else?

ShoPro702
Guest
ShoPro702
1 year 7 months ago

lol

YiumPotato
Guest
YiumPotato
1 year 11 months ago

"CharField" not "Charfield", little typo you got there 😉

Vignesh S
Guest
Vignesh S
2 years 11 days ago

when i do python manage.py startapp myapp, its not creating apps.py file.

Qua Da
Guest
Qua Da
2 years 18 days ago

when i type Album.objects.all()given error :OperationalError: no such table: music_album

Deadalus DX
Guest
Deadalus DX
2 years 20 days ago
*After I type "python manage.py makemigrations", I am getting a huge error. No spelling mistakes in models.py, i checked it.*E:DevelopmentDjango Tutorialsbuckynew>python manage.py makemigrationsTraceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "C:Python34libsite-packagesdjangocoremanagement__init__.py", line 353, in execute_from_command_line utility.execute() File "C:Python34libsite-packagesdjangocoremanagement__init__.py", line 327, in execute django.setup() File "C:Python34libsite-packagesdjango__init__.py", line 18, in setup apps.populate(settings.INSTALLED_APPS) File "C:Python34libsite-packagesdjangoappsregistry.py", line 108, in populate app_config.import_models(all_models) File "C:Python34libsite-packagesdjangoappsconfig.py", line 202, in import_models self.models_module = import_module(models_module_name) File "C:Python34libimportlib__init__.py", line 109, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 2254, in _gcd_import File "<frozen importlib._bootstrap>", line 2237, in _find_and_load File "<frozen importlib._bootstrap>", line 2226,… Read more »
Rudy Nghepkam
Guest
Rudy Nghepkam
1 year 23 days ago

thanks bro

prarth desai
Guest
prarth desai
1 year 2 months ago

thanks…it solved my problem

AnIndianTechie
Guest
AnIndianTechie
1 year 3 months ago

change all 'Charfield' to 'CharField' and 'Foreignkey' to 'ForeignKey' in models.py .

Andrew Chen
Guest
Andrew Chen
1 year 5 months ago

Hey so I know that it's 6 months too late now, but I had the same problem as you, and the problem was that you needed to reinstall django, but i did it the second time through "sudo pip install Django==1.9.1" this is for mac, and i would assume that you could just google how to install django through windows or linux. Happy coding.

Cash DeLeon
Guest
Cash DeLeon
1 year 8 months ago

Looks like you misspelled your module nameor using the wrong name

MCMXCVII
Guest
MCMXCVII
1 year 8 months ago

this is my problemTraceback (most recent call last): File "manage.py", line 22, in <module> execute_from_command_line(sys.argv) File "/usr/local/lib/python2.7/dist-packages/Django-1.10.2-py2.7.egg/django/core/management/__init__.py", line 367, in execute_from_command_line utility.execute() File "/usr/local/lib/python2.7/dist-packages/Django-1.10.2-py2.7.egg/django/core/management/__init__.py", line 341, in execute django.setup() File "/usr/local/lib/python2.7/dist-packages/Django-1.10.2-py2.7.egg/django/__init__.py", line 27, in setup apps.populate(settings.INSTALLED_APPS) File "/usr/local/lib/python2.7/dist-packages/Django-1.10.2-py2.7.egg/django/apps/registry.py", line 85, in populate app_config = AppConfig.create(entry) File "/usr/local/lib/python2.7/dist-packages/Django-1.10.2-py2.7.egg/django/apps/config.py", line 123, in create import_module(entry) File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module _import_(name)ImportError: No module named MusiConfig

MCMXCVII
Guest
MCMXCVII
1 year 8 months ago

I have the same errors until i makemigrationthe there is a problem in my models album

- Anonymous
Guest
- Anonymous
1 year 9 months ago

thanks

Adarsh s
Guest
Adarsh s
1 year 10 months ago

Its ForeignKey*, that's why its showing the error.

Harry Teran
Guest
Harry Teran
1 year 10 months ago

its "CharField" not "charfield" :__ i have the same problem but with ForeingKey … soo wtf?

Cash DeLeon
Guest
Cash DeLeon
1 year 11 months ago

Idk if this is too late. But I just had a simple type error in my music.models.py that caused everything to go wrong, hopefully this helps!

mikem9389
Guest
mikem9389
2 years 5 days ago

Make sure to use models.Model for the class parameter, not models.model

Aliz Sanders
Guest
Aliz Sanders
2 years 14 days ago

I had the same problem. In website>settings.py , make sure you put apps between music. and MusicConfig, that's exactly what happened to me.'music.apps.MusicConfig',

Deadalus DX
Guest
Deadalus DX
2 years 19 days ago

the coma exists, I still get the error/

chickenMCB (Disabled Gamer)
Guest
chickenMCB (Disabled Gamer)
2 years 19 days ago

don't forget to add a "," after  music.apps.MusicConfig in settings.py

Rabin Gaire
Guest
Rabin Gaire
2 years 1 month ago

can't i just write music to install music app

Neydson Macedo
Guest
Neydson Macedo
2 years 1 month ago

thx 😀

Kalyan N C
Guest
Kalyan N C
2 years 1 month ago

Django server doesn't throw warning when just models.py is edited. Only after makemigrations is run does the server throws warning that migrations are pending. Please correct this.

TheCodeAcademy
Guest
TheCodeAcademy
2 years 2 months ago

ImportError: No module named appsHow can I fix this?

Chandan Saha
Guest
Chandan Saha
1 year 9 months ago

I think u miss the comma(,) after this code 'music.apps.MusicConfig' in settings.py

Ishwar Kumar
Guest
Ishwar Kumar
1 year 11 months ago

me too did same mistake

MAYANK JINDAL
Guest
MAYANK JINDAL
2 years 1 month ago

+Efe Öge Thanks I was doing same mistake

Efe Öge
Guest
Efe Öge
2 years 2 months ago

+TheCodeAcademy You may forget to add comma (,) end of the line. It should be like:'music.apps.MusicConfig',

Ricky Singh
Guest
Ricky Singh
2 years 2 months ago

+TheCodeAcademy in the main website folder go to settings.py and inside the installed_apps list write 'music', instead of 'music.apps.MusicConfig'

Aram Yeghiazaryan
Guest
Aram Yeghiazaryan
2 years 2 months ago

Bucky are you sure these tutorials are for beginners? 😀 Great job, keep it up

Joost Jansen
Guest
Joost Jansen
2 years 2 months ago

Django is pretty awesome, especially when compared to Flask where you don't have models and such. I'm wondering though, how easy would it be to make a Django application with a mongodb database since mongo doesnt have sql

Samaksh Jain
Guest
Samaksh Jain
2 years 2 months ago

+BitsPls Afaik, Flask has models. Its almost like a heavily stripped down version of Django, basically it does not take most of your architectural decisions for you as Django does.

wpDiscuz