Django py manage.py makemigrate

806 views Asked by At

What can I make with it? I'm beginner in python and django. I download it and I i wrote py manage.py makemigrate and I've get error. Can u help me?

3

There are 3 answers

4
Rarblack On BEST ANSWER

Your issue is with your DB configuration in the setting.py. If you are using the default SQLite then copy/paste this:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}

and your project will work just fine. After this, run

python manage.py makemigrations
python manage.py migrate #copy all migrations to the database
python manage.py createsuperuser #to have a admin user to login to adminpanel
python manage.py runserver #starting the server

Otherwise, take a look at the official documentation how to connect MySQL, PostgreSQL, Oracle databases and required configurations.

Your error is in here:

SQLite is not like MySQL or other databases. Actually, it is not a real database. You are using a port, username, password and etc. These are the cause of the error. SQLite is not running in the server or another place. It is just a single file contains data information. Update yours to mine above and it should start work again or change your database to MySQL or others.

2
Gautham Santhosh On

If you are a beginner it is better to stay with the documentation and do like https://docs.djangoproject.com/en/2.1/intro/tutorial01/

If you could share the DB part of the settings.py it would help.

Generally python manage.py startapp appname should create the necessary files for you. After which a python manage.py makemigrations and python manage.py migrate should work properly. And this should not come.

0
vishes_shell On

You need to supply all environment variables that are listed in your settings file. Such as DB_NAME that presented in your screenshot. Search for os.environ[<VARIABLE_NAME>], every VARIABLE_NAME should be defined.