noobcoderiam
noobcoderiam

Reputation: 508

manage.py runserver opens up pycharm instead of running server

I'm pretty new to coding in general and could really use someones help with this! I installed django via CMD on my WIN 10 computer and when I run the server it works.

D:\Python\Python37-32\website>manage.py runserver 8080
Performing system checks...

System check identified no issues (0 silenced).
August 04, 2018 - 15:32:59
Django version 2.1, using settings 'website.settings'
Starting development server at http://127.0.0.1:8080/
Quit the server with CTRL-BREAK.

However... I than downloaded Pycharm Community edition on my computer and instead of the server starting, it just opens up the pycharm ide and the server doesnt run. The interpreter looks fine as well.

D:\Python\Python37-32\website>manage.py runserver 8080
D:\Python\Python37-32\website>

Upvotes: 4

Views: 1905

Answers (2)

GooDeeJAY
GooDeeJAY

Reputation: 1830

Simple solution:

python manage.py runserver

However, If you want to run this as manage.py runserver, you should change the default program for .py files from PyCharm to Python:

Right click on any .py file > Properties > General tab > Opens with > Change

(No need to uninstall / reinstall PyCharm)


Then, when you try calling manage.py runserver, you can face another problem: command line arguments (runserver in our case) will not be passed to the program.

The solution to the problem will be some registry configuration:

[HKEY_CLASSES_ROOT\Applications\python.exe\shell\open\command]
@="\"C:\\Python38\\python.exe\" \"%1\" %*"

The registry setting above adds the %* to pass all arguments to python.exe

Upvotes: 0

Nikita Tonkoskur
Nikita Tonkoskur

Reputation: 1499

You should change default program for .py files from pycharm to "python"

Upvotes: 6

Related Questions