Forums

How can I do runserver command for a Django project?

I'm trying to create a uMap with following instruction.

https://umap-project.readthedocs.io/en/latest/install/

Luckey, I reached the end of instruction, runserver.

The privious databese issue was fixed. https://www.pythonanywhere.com/forums/topic/29543/#id_post_93208

so, I'm stuck at runserver. I don't know suitable ip and port number. Let me know, how shoud I put ip and port, and how to publish the web service.

My try and error log is bellow ([myID] is my id letters)

(vmap) 07:20 ~ $ umap runserver 0.0.0.0:8000
Loaded local config from /home/[myID]/local.py
Loaded local config from /home/[myID]/local.py
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
May 01, 2021 - 07:23:29
Django version 2.2.17, using settings 'umap.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.
Error: That port is already in use.

(vmap) 07:23 ~ $ umap runserver [myID].pythonanywhere.com:8000                                                                            Loaded local config from /home/[myID]/local.py
Loaded local config from /home/[myID]/local.py
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
May 01, 2021 - 07:26:30
Django version 2.2.17, using settings 'umap.settings'
Starting development server at http://[myID].pythonanywhere.com:8000/
Quit the server with CONTROL-C.
Error: That IP address can't be assigned to.

(vmap) 07:26 ~ $ umap runserver [myID].pythonanywhere.com:80
Loaded local config from /home/[myID]/local.py
Loaded local config from /home/[myID]/local.py
Watching for file changes with StatReloader
Performing system checks...
Quit the server with CONTROL-C.
Error: That IP address can't be assigned to.

(vmap) 07:26 ~ $ umap runserver [myID].pythonanywhere.com:80
Loaded local config from /home/[myID]/local.py
Loaded local config from /home/[myID]/local.py
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
May 01, 2021 - 07:27:00
Django version 2.2.17, using settings 'umap.settings'
Starting development server at http://[myID].pythonanywhere.com:80/
Quit the server with CONTROL-C.
Error: That IP address can't be assigned to.

(vmap) 07:27 ~ $ umap runserver [myID].pythonanywhere.com
Loaded local config from /home/[myID]/local.py
CommandError: "[myID].pythonanywhere.com" is not a valid port number or address:port pair.

(vmap) 07:27 ~ $ umap runserver [myID].pythonanywhere.com:0080
Loaded local config from /home/[myID]/local.py
Loaded local config from /home/[myID]/local.py
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
May 01, 2021 - 07:27:27
Django version 2.2.17, using settings 'umap.settings'
Starting development server at http://[myID].pythonanywhere.com:0080/
Quit the server with CONTROL-C.
Error: That IP address can't be assigned to.

(vmap) 07:27 ~ $ umap runserver 127.0.0.1:8000
Loaded local config from /home/[myID]/local.py
Loaded local config from /home/[myID]/local.py
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
May 01, 2021 - 07:32:35
Django version 2.2.17, using settings 'umap.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Error: That port is already in use.

I'm using this parameter in local.py

INTERNAL_IPS = ('127.0.0.1', )
ALLOWED_HOSTS = ['*', ]

runserver command is for local development purposes -- you can use it on your local machine. On PythonAnywhere you need to configure a web app. So the development cycle on PythonAnywhere would be slightly different than on the local machine -- every time you change the source code of your web app, you need to reload it for the changes to take effect.

Thank you for your quick reply. So that means no solution on pythonanuwhere? Should I move to other platform? Let me know your opinion. My purpose is creating a uMap project web service.

I suppose the solution is not using runserver command at all and following the methodology I described above (if you want to develop your app on PythonAnywhere directly).

I made it! Finally, my uMap service starts working.

This Tutorial was the hint, so I struggled for several hours and fixed it. https://help.pythonanywhere.com/pages/FollowingTheDjangoTutorial/ I should edit auto ganalated wsgi by pythonanywhere web console to indicate installed umap's settings.

Thank you

Glad to hear you got that working!