1. Deployment Architecture
I separated the application into three main component
Next.js Frontend
Note: Hosted at https://example.com
Handles the user interface
Forwards /api/* requests to Django
Django Backend
Hosted at https://backend.example.com
Handles API requests and business logic
Communicates with MySQL
MySQL Database
Manage through cPanel
Stores application data
Uses de dicated database credentials
2. Configuring the Production Environment
configure separate Python and Node.js applications using cPanel.
For Django:
Configure production environment variables
Connect MySQL
Apply database migrations
Collect static files
Disable debug mode
For Next.js:
Install dependencies
Built the production application
Configure the Node.js startup file
Connect frontend requests to Django
3. Problems and Solution
MySQL Error 1045 — Access Denied
The database connection failed because the credentials and database user configuration needed verification.
Solution: Verified the full cPanel-prefixed database username, password, and database privileges.
Node.js Command Not Found
The Node.js runtime was not available in the active shell environment.
Solution: Activated the Node.js environment provided by cPanel.
Frontend Could Not Reach Django
Requests were targeting 127.0.0.1:8000, which was not the correct production backend destination.
Solution: Configured the production Django origin and forwarded API requests through Next.js.
Next.js Build Compatibility Issues
The hosting environment had compiler/runtime compatibility limitations.
Solution: Checked the server compatibility requirements and production build environment.
404 Errors and Incorrect Domain Routing
The domain was not correctly mapped to the application.
Solution: Inspected the cPanel domain configuration and restored the required Passenger application mapping.
4. Biggest Lessons
A successful full-stack deployment requires more than uploading source code.
You must independently verify:
Database connectivity Backend startup and API health Frontend production build Domain and application routing Static and media file delivery HTTPS and production security
Biggest takeaway:
Development proves that your application works on your machine. Deployment proves that your application works in a real hosting environment. Understanding the difference is an essential part of becoming a better software engineer. Have you deployed Django or Next.js on shared hosting? What was your biggest challenge?
Join the discussion
Ask a question or share what you learned. Comments are reviewed before appearing.