Problems synchronizing the database in Django

0

I'm creating an app in Django and when I try to run "makemigrations" I get the following error

> (env) C:\Users\Jorge Ceron\env\Scripts\lgsbeta>python manage.py
> makemigrations Traceback (most recent call last):   File "manage.py",
> line 22, in <module>
>     execute_from_command_line(sys.argv)   File "C:\Users\JORGEC~1\env\lib\site-packages\django\core\management\__init__.
> py", line 367, in execute_from_command_line
>     utility.execute()   File "C:\Users\JORGEC~1\env\lib\site-packages\django\core\management\__init__.
> py", line 341, in execute
>     django.setup()   File "C:\Users\JORGEC~1\env\lib\site-packages\django\__init__.py", line 27,
> in  setup
>     apps.populate(settings.INSTALLED_APPS)   File "C:\Users\JORGEC~1\env\lib\site-packages\django\apps\registry.py",
> line 1 08, in populate
>     app_config.import_models(all_models)   File "C:\Users\JORGEC~1\env\lib\site-packages\django\apps\config.py", line
> 199 , in import_models
>     self.models_module = import_module(models_module_name)   File "c:\python27\Lib\importlib\__init__.py", line 37, in import_module
>     __import__ (name)   File "C:\Users\Jorge Ceron\env\Scripts\lgsbeta\lgsbeta1\models.py", line 5, in  <module>
>     class Expansion(models.Model):   File "C:\Users\Jorge Ceron\env\Scripts\lgsbeta\lgsbeta1\models.py", line 6, in  Expansion
>     Nombre_exp = models.Charfield(max_length=30) AttributeError: 'module' object has no attribute 'Charfield'

By checking Django's documentation he tells me that we have to do false migrations and that if we have duplicate migrations it will not be able to be executed.

I have read that you have to apply and disengage the migrations, but it does not end up being clear to me

    
asked by Tajaludo 26.12.2016 в 03:19
source

2 answers

0

is a typo! CharField (). No Charfield.

    
answered by 26.12.2016 / 05:54
source
0

The error tells you that the django models module does not have the Charfield attribute so it tells you that there is something wrong ... The correction is to use CharField which as you see has the ' F ' in uppercase ... This will solve your problem

    
answered by 26.12.2016 в 16:49