Mostafa Gafer
Mostafa Gafer

Reputation: 73

python manage.py runserver doesn't display anything

I used to work with django and I didn't face this problem in the past, Then I shifted for a while to Laravel ( and sure I changed a lot of things in the windows which I don't remember ).

and now when I hit python manage.py runserver .. nothing happen and the shell seems as it hanged . hover once I hit crt + C .the normal window suddenly appear that says :

You have 15 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions. Run 'python manage.py migrate' to apply them. January 08, 2019 - 14:16:30 Django version 2.1.1, using settings 'django_project.settings' Starting development server at http://127.0.0.1:8000/ Quit the server with CTRL-BREAK.

However I am able to go to http://127.0.0.1:8000/ and I have the welcome page of django with this line added enter image description here

It sounds crazy I know , please excuse me cause I am a newbie and thanx in advance

Upvotes: 2

Views: 5332

Answers (4)

user20960802
user20960802

Reputation: 1

python manage.py runserver works correctly.

Upvotes: 0

Suman Deol
Suman Deol

Reputation: 384

The first line in manage.py breaks the file on windows. The first line should look like this:

#!/usr/bin/env python

Removing it will fix the issue

Upvotes: 2

Sergio
Sergio

Reputation: 334

To apply migrations run:

python manage.py makemigrations
python manage.py migrate

Seems like you've just installed django and every time you do so, you should apply the migrations. This synchronizes the database state with your current set of models and migrations.

More about migrations

Upvotes: 1

Alberto de Prezzo
Alberto de Prezzo

Reputation: 96

Looks like you've to apply migrations.

You've just to run what he says:

python manage.py migrate

I think it's better to look at the documentation before you proceed: you've to understand how models work in Django. Take a look to the documentation first. And my advice is to follow the "first app" tutorial. Go here

Upvotes: 3

Related Questions