deploy your application
No account is required. Learn the material, try the examples, and mark it complete when you are ready to move on. Sign in with email only if you want to save progress across devices.
Tutorial 05 - Deploy Your Application
Phase 5 - Make Applications Real
The big idea
A website is not useful to another person if it only runs on your laptop.
Deployment means moving the application from your development environment into an environment where another person can access it.
The official Phase 5 project defines the outcome simply:
I can put my application in front of another person.
It focuses on hosting, remote dependencies, database configuration, environment variables, public URLs, and deployment troubleshooting. fileciteturn13file4L561-L580
1. Local application
During development:
Your computer
↓
Django
↓
BrowserYou might run:
python manage.py runserverand open:
http://127.0.0.1:8000/That URL points to your own computer.
Someone else cannot normally use it as your public product URL.
2. Deployed application
After deployment:
Your computer
↓
Deploy
↓
Hosted server
↓
Internet
↓
Another person's browserNow your application has a public address.
That is the fundamental purpose of deployment.
3. What is a server?
A server is a computer/system that provides resources or services to other computers.
In this context, a hosted server runs your web application.
Conceptually:
Server
├── application code
├── Python environment
├── dependencies
├── configuration
└── access to databaseYou do not need to own a physical server.
A hosting provider can provide the infrastructure.
4. What does a hosting provider do?
A hosting provider gives you an environment where your application can run.
Different providers have different interfaces.
The exact provider is less important than understanding the questions:
- Where is the code hosted?
- Where does the application run?
- Where does the database live?
- How are environment variables configured?
- How does the application start?
- Where do logs appear?
These are the important deployment concepts emphasized in the Phase 5 implementation. fileciteturn13file4L621-L632
5. Before deployment
Your project should contain the important pieces:
source code
requirements.txt
templates
static files
environment configuration
database configurationThe Phase 5 project recommends committing the project to Git before deployment. fileciteturn13file4L608-L619
6. Why Git matters
Deployment systems commonly retrieve your source code from a repository.
Git gives you:
history
versions
branches
commitsA useful workflow is:
Build locally
↓
Test
↓
Commit
↓
Push
↓
DeployDo not deploy an untested pile of changes if you can avoid it.
7. The deployment pipeline
A simplified pipeline:
Git repository
↓
Hosting platform
↓
Install Python
↓
Install requirements
↓
Set environment variables
↓
Configure database
↓
Run application
↓
Public URLThe exact commands differ by hosting provider.
The architecture remains similar.
8. Requirements installation
The remote environment does not know what packages your laptop has installed.
It may run:
pip install -r requirements.txtThat is why the requirements file matters.
If your application imports:
import django
import PILthe remote environment needs those dependencies installed.
9. Environment variables
Your deployment environment needs configuration.
Examples:
SECRET_KEY
DEBUG
ALLOWED_HOSTS
DATABASE_URL
API_KEYThese should be configured in the hosting environment rather than committed as secrets.
Conceptually:
Hosting settings
↓
Environment variables
↓
Django10. Database deployment
This is a common source of confusion.
Your local database might contain:
Booking #1
Booking #2
Booking #3The production database may initially contain nothing.
Your application code and your database are separate things.
Code
≠
DataA deployment may need:
python manage.py migrateto create the required database schema.
If you need sample data, seed it deliberately.
11. Application startup
The hosting platform needs to know how to start your Django application.
The production server typically needs an application entry point.
Django projects commonly expose WSGI or ASGI application objects.
You do not need to memorize the internals.
Understand:
Hosting platform
↓
Starts Django application
↓
Application listens for web requests12. Logs are your friend
When deployment fails, do not guess.
Find the logs.
You may see:
ModuleNotFoundErrorThis suggests a missing dependency.
Or:
ImproperlyConfiguredThis suggests a configuration problem.
Or:
DisallowedHostThis suggests host configuration.
Or:
OperationalErrorThis may indicate a database problem.
The skill is:
Read the deployment log and identify which layer failed.
13. Common deployment failures
Missing dependency
ModuleNotFoundErrorCheck:
requirements.txtMissing environment variable
The application expects:
SECRET_KEYbut the hosting environment does not provide it.
Wrong allowed host
Django rejects the incoming hostname.
Database not configured
The application cannot connect to the expected database.
Static files missing
The HTML loads but:
CSS missing
images missing
JavaScript missingIncorrect startup command
The platform cannot start the Django application.
14. Debugging deployment systematically
Use:
1. Did the build succeed?
2. Were dependencies installed?
3. Were environment variables configured?
4. Did the database connect?
5. Did migrations run?
6. Did the application start?
7. Can the server receive a request?
8. Are static files available?Do not change five things at once.
15. The first public test
Once deployed:
Open public URL
↓
Homepage
↓
Core user journey
↓
Database action
↓
ResultTest the application exactly as a user would.
16. Test with another person
This is one of the most valuable exercises in Phase 5.
Give the URL to someone who was not involved in building the application.
Do not explain the interface immediately.
Ask them to use it.
The official project recommends observing whether they understand the application, can complete the core task, and where they become confused. fileciteturn13file4L651-L663
17. Why outside testing matters
You know:
where the button is
what the terminology means
what should happen
which steps are requiredA new user does not.
That makes you a poor judge of discoverability.
Watch the user.
Do not defend the interface.
Record what actually happens.
18. Deployment exercise
Create a deployment checklist:
□ Git repository ready
□ requirements.txt ready
□ environment variables identified
□ secrets excluded
□ database configured
□ migrations ready
□ static files considered
□ application start command known
□ logs accessible
□ public URL worksThen deploy.
19. Break-and-diagnose exercise
The Phase 5 project recommends deliberately inspecting deployment failures such as:
missing environment variable
missing dependency
incorrect allowed host
static-file configuration issueand asking:
Where did the application fail? fileciteturn13file4L634-L649
You can simulate some failures in a controlled environment.
For example:
Remove a non-sensitive test configuration valueDeploy.
Read the log.
Restore it.
This teaches deployment as a debugging process rather than a magical button.
20. Using ChatGPT
Good deployment prompt:
My Django deployment fails. Here is the exact hosting log, my requirements.txt, and the relevant settings. Identify the first meaningful failure, explain why it occurs, and give me the smallest fix. Do not rewrite the deployment architecture.
If static files fail:
The deployed HTML loads, but CSS does not. Explain how to trace the browser request, Django static configuration, and hosting configuration before changing anything.
21. Completion criteria
You have completed this project when:
Another person
↓
opens public URL
↓
understands the application
↓
completes the core task
↓
gets the expected resultThat is more meaningful than:
"The deployment command said successful."
Remember
Deployment is the transition:
My laptop
↓
Hosted application
↓
Internet
↓
Real userThe Phase 5 project defines success as another person being able to open the application through a public URL and use its core functionality. fileciteturn13file4L664-L671
Finished this lesson?
Keep your place here, or save it across devices with an email link.
Saved in this browser. Save progress with email →