Django is a python free and open-source framework that is widely used nowadays. It offers a lot of libraries and functions that can be easily invoked. Running Django app with a local Django server will help you to speed up the development process. Let’s see what is the best and quick way to run it.
Prerequisites
- Python
- pip
Solution
Step 1. First, let’s see the default or minimal Django app structure:
ls djangoapp/
__init__.py
manage.py
settings.py
urls.py
Step 2. To start the Django server app on the default port, run:
python manage.py runserver
Output:
Validating models...
0 errors found.
Django version 2.0, using settings 'mysite.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Step 3. If you want to change the default port and run the Django server in the background, run:
python manage.py runserver 8080 &
&
: Will run the server process in background.
Step 4. My preferred way is to make it listen on all public IPs along with the port.
python manage.py runserver 0.0.0.0:8000 &
Conclusion
You can try it on your server or locally and let us know! On a side note, follow our official channel on Telegram.