Start Django Local Web Server: 5 Easy Steps (2026 Guide)
Once you’ve built a Django project, the first question most beginners ask is how to start Django local web server on their own machine. In this article, NIMA Academy walks you through the process step-by-step — practical and hands-on, so you can see your project running in the browser in minutes.
Table of Contents
What Is a Django Local Web Server?
Django is an open-source Python web framework. While developing a Django project, you don’t need to upload your code to the internet just to test it — Django ships with a built-in development server that lets you run and test your project locally. This is what’s known as the Django local web server. It lets you see your changes instantly in the browser before deploying to a real production server.
Prerequisites
Before you start Django local web server, make sure your computer has:
- Python (version 3.9 or newer) installed
- pip (Python’s package manager) ready to use
- Basic familiarity with a terminal or command prompt
If Python isn’t installed yet, you can download it from the official Python website.
Step 1 – Create a Virtual Environment
Creating a virtual environment keeps your project’s dependencies clean and isolated — it’s considered best practice.
python -m venv myenv
Then activate it:
Windows:
myenv\Scripts\activate
Mac/Linux:
source myenv/bin/activate
Step 2 – Install Django
With your virtual environment activated, install Django using pip:
pip install django
Verify the installation:
django-admin --version
Step 3 – Create a Django Project
Now let’s create a new Django project:
django-admin startproject myproject
This generates a myproject folder with all the necessary starter files. Move into that folder:
cd myproject
Step 4 – Start Django Local Web Server (runserver)
This is the key step. To start Django local web server, run the following command:
python manage.py runserver
This launches Django’s built-in development server, usually at http://127.0.0.1:8000/. You can also run it on a custom port:
python manage.py runserver 8080
Step 5 – Test the Server in Your Browser
Once the server is running, open your browser and go to http://127.0.0.1:8000/. If you see Django’s default “The install worked successfully!” page, you’ve successfully managed to start Django local web server!
Common Errors and How to Fix Them
- “python: command not found” – Python isn’t installed correctly, or isn’t in your system PATH. Check your environment variables.
- “Port already in use” – Another process is already using that port. Try a different port, e.g.
runserver 8080. - “ModuleNotFoundError: No module named ‘django'” – Your virtual environment isn’t activated. Revisit Step 1.
- “DisallowedHost” error – Add your host to the
ALLOWED_HOSTSlist in yoursettings.pyfile.
Bonus Tips
- The development server auto-reloads whenever you save your code — no need to restart it manually.
- Never use
runserverin production — it’s strictly for local testing. - To stop the server, press
CTRL + Cin your terminal.
Conclusion
Learning to start Django local web server is simple — follow the five steps above and you’ll have your own Django project running locally within minutes. To go deeper and master this process, check out NIMA Academy’s Django Programming Course, alongside our Networking and Linux courses, all taught step-by-step.
Django project එකක් හදාගත්ට පස්සේ බොහෝ අයට එන පළවෙනි ප්රශ්නය තමයි — “Start Django Local Web Server” කරන්නේ කොහොමද කියලා. මේ article එකෙන් අපි ඔබට step-by-step, Sinhala භාෂාවෙන්ම, Django development server එකක් ඔබේ පරිගණකයේ run කරගන්නා ආකාරය පෙන්නනවා — NIMA Academy style එකට practical, hands-on විදිහ
Django Local Web Server කියන්නේ මොකක්ද?
Django, Python වලින් හදපු open-source web framework එකක්. ඔබ Django project එකක් develop කරද්දී, ඔබේම code එක internet එකට upload කරන්නට කලින්, local machine එකේම test කරගන්න පුළුවන් built-in development server එකක් Django සතුව තියෙනවා. මේකට කියනවා Django local web server කියලා. මේකෙන් ඔබට changes instant විදිහට browser එකේ බලාගන්න පුළුවන්, production server එකකට deploy කරන්නට කලින්.
පෙර සූදානම (Prerequisites)
Start Django Local Web Server කරන්නට කලින්, ඔබේ පරිගණකයේ මේවා තියෙන්න ඕන:
- Python (3.9 හෝ ඊට වැඩි version එකක්) install කරලා තියෙන්න ඕන
- pip (Python package manager) එක ready වෙලා තියෙන්න ඕන
- Terminal / Command Prompt එකක් පාවිච්චි කරන්නට දැනුමක්
Python install වෙලා නැත්නම්, official Python website එකෙන් download කරගන්න පුළුවන්.
Step 1 – Virtual Environment එකක් සාදන්න
Project එකේ dependencies clean විදිහට manage කරගන්න, virtual environment එකක් හදාගන්න එක best practice එකක්.
python -m venv myenv
ඊට පස්සේ activate කරන්න:
Windows:
myenv\Scripts\activate
Mac/Linux:
source myenv/bin/activate
Step 2 – Django Install කරන්න
Virtual environment එක activate වුණාට පස්සේ, pip පාවිච්චි කරලා Django install කරගන්න:
pip install django
Install වුණාද කියලා check කරන්න:
django-admin --version
Step 3 – Django Project එකක් සාදන්න
දැන් අලුත් Django project එකක් සාදමු:
django-admin startproject myproject
මේකෙන් myproject කියන folder එකක් සහ ඒ ඇතුළේ අවශ්ය files auto-generate වෙනවා. ඊට පස්සේ ඒ folder එකට යන්න:
cd myproject
Step 4 – Start Django Local Web Server (runserver)
මේ තමයි key step එක. Start Django Local Web Server කරන්න ඕන නම්, පහත command එක run කරන්න:
python manage.py runserver
මේ command එකෙන් Django built-in development server එක start වෙනවා, සාමාන්යයෙන් http://127.0.0.1:8000/ කියන address එකේ. Port එක වෙනස් කරන්නත් පුළුවන්:
python manage.py runserver 8080
Step 5 – Browser එකෙන් Server එක Test කරන්න
Server එක start කරාට පස්සේ, browser එක open කරලා http://127.0.0.1:8000/ කියලා type කරන්න. Django default “The install worked successfully!” page එක පෙන්නනවා නම්, ඔබ සාර්ථකව Start Django Local Web Server කරලා ඉවරයි!
Common Errors සහ ඒවා විසඳන ආකාරය
- “python: command not found” – Python correctly install වෙලා නැති නිසා. PATH environment variable එක check කරන්න.
- “Port already in use” – වෙන process එකක් ඒ port එකෙන් run වෙනවා.
runserver 8080වගේ වෙනත් port එකක් පාවිච්චි කරන්න. - “ModuleNotFoundError: No module named ‘django'” – Virtual environment එක activate කරලා නැති නිසා. Step 1 re-check කරන්න.
- “DisallowedHost” error –
settings.pyfile එකේALLOWED_HOSTSlist එකට ඔබේ host එක add කරන්න.
Bonus Tips
- Development server එක auto-reload වෙනවා, ඔබ code save කරාම — server restart කරන්න ඕන නෑ.
- Production එකට කවදාවත්
runserverපාවිච්චි කරන්න එපා — ඒක local testing සඳහා විතරයි. - Server එක stop කරන්න
CTRL + Ctype කරන්න terminal එකේ.
නිගමනය
Start Django Local Web Server කරන එක සරලයි, ඉහත step 5 follow කළොත් විනාඩි කිහිපයකින් ඔබට ඔබේම Django project එක local විදිහට run කරගන්න පුළුවන්. මේ process එක practice කරලා master කරගන්න NIMA Academy හි Django Programming Course එක බලන්න — Networking සහ Linux course ටිකත් එක්ක step-by-step ඉගෙන ගන්න පුළුවන්.
