Godaddy域名搭配DtDNS动态DNS部署Django站点出现空白页求助
Hey there, let's work through this blank page issue step by step—since your local setup runs perfectly on Apache + mod_wsgi, the problem is almost certainly tied to public-facing routing or configuration gaps. Here's what to check:
Verify Dynamic DNS Resolution
First, confirm your DtDNS domain is pointing to the correct public IP. Grab your Pi's public IP withcurl ifconfig.me, then from a device off your home network (like a phone on cellular), runnslookup your-dtdns-domain.comordig your-dtdns-domain.com. If the returned IP doesn't match your Pi's, double-check your DtDNS update script on the Pi—ensure it's running on schedule and has valid authentication credentials.Check Router Port Forwarding
Your router needs to forward incoming HTTP (port 80) and/or HTTPS (port 443) traffic to your Pi's local IP. Make sure:- The local IP of your Pi is static (use DHCP reservation in your router or set it via
/etc/dhcpcd.confon the Pi to avoid IP changes breaking the rule) - The port forwarding rule targets the correct local IP and ports
- Some ISPs block port 80—if you hit this, try using a non-standard port (like 8080) for forwarding, then access your site as
your-domain.com:8080
- The local IP of your Pi is static (use DHCP reservation in your router or set it via
Validate Apache Configuration
Local success doesn't mean public-facing config is right:- Ensure your
<VirtualHost>block listens on*:80(not justlocalhost:80) so Apache accepts requests from outside your network - Set the
ServerNamedirective in your virtual host to match your GoDaddy/DtDNS domain - Confirm
WSGIScriptAliaspoints to the correct path of your Django project'swsgi.pyfile - Check file permissions: Apache's user (usually
www-data) needs read access to your Django project files. Runsudo chown -R www-data:www-data /path/to/your/django/projectif needed - Test config validity with
sudo apache2ctl configtestand restart Apache withsudo systemctl restart apache2
- Ensure your
Local Firewall Rules
If you haveufwenabled on the Pi, make sure it allows incoming traffic on ports 80/443:sudo ufw allow 80/tcp sudo ufw allow 443/tcp sudo ufw reloadVerify active rules with
sudo ufw statusBrowser & Network Debugging
- Access your site in incognito/private mode to rule out cached blank responses
- Open your browser's developer tools (Network tab) to check the HTTP status code:
- 200: Server responded, but content isn't rendering—check Django's templates or static files configuration
- 404/500: Server-side error—look at Apache's error logs for details
- 3xx: Redirect loop or misconfigured redirects
- If you get no response at all, your traffic isn't reaching the Pi—circle back to port forwarding and DNS checks
Dig Into Logs
Logs are your best friend here. Tail Apache's error log while accessing the site to catch real-time issues:sudo tail -f /var/log/apache2/error.logCheck the access log to confirm requests are hitting the Pi:
sudo tail -f /var/log/apache2/access.log
内容的提问来源于stack exchange,提问作者JulienK

