简体   繁体   中英

Linode/Django Can't see site when I runserver at ip:8000

I had started a fresh linode running ubuntu 19.04 and the first time I used the directions at:

https://www.rosehosting.com/blog/how-to-install-mezzanine-cms-on-ubuntu-18-04/

To install Mezzanine CMS it worked just fine, I could run the runserver command and see the django website. Eventually it started giving me a problem after trying 50 ways to deploy the site using apache and mod_wsgi.

I gave up and rebuilt the server and then still couldn't see the new install at the IP when I ran run server. I figured maybe it was because I accidentally installed some things using "python" and others with "python3" so I rebuilt the server.

This third time I followed the direction perfectly, the only difference is I didn't install a mysql server just kept the default SQLlite server and created a DB and Django Superuser.

  • I have added my ip as a host in settings.py and local_settings.py
  • I have already ran makemigrations and migrate
  • I did check to see if maybe the IP had changed when I rebuilt, it hadn't
  • My local environment on my laptop works fine, just not the linode

Any suggestions on anything I'm missing?

Deployment Guide

Step 1 (Installation)

  • Install apache2 mod_wsgi

  • Install virtualenv

  • Install virtualenv

  • Install Nginx for asynchronous event-driven approach to handle multiple client requests

  • Install mysql

    sudo apt-get update

    sudo apt-get install python3-pip python3-dev apache2 libapache2-mod-wsgi-py3

    sudo apt-get install virtualenv ufw

    sudo apt-get install nginx

    sudo apt-get install mysql-server libmysqlclient-dev

    sudo mysql_secure_installation

Step 2 (Apache & Hostname & User)

Step 3 (Firewall)

  • sudo ufw allow 8000

  • sudo ufw allow http

  • sudo ufw allow ssh

  • sudo ufw default allow outgoing

  • sudo ufw default deny incoming

  • Enable all other required port numbers

  • ssh sudo ufw enable

Step 4 (Django configuration)

  • Chown static and media forlders and edit it's permission recursively
  • Add allowed host in settings.py
  • Checkout deployment checklist in django official website and do it.

Step 5 (Please checkout)

For this particular problem turned out I just needed to suddenly bind dev server to 0.0.0.0

the command to do so was

python manage.py runserver 0.0.0.0:8000

Rinshans answers is definetley the details for deployment, I've followed those steps just kept making some mistake in the config and wsgi scripts. I'm going to try deploying with Gunicorn or use the Fabric self-deployment tools built in to Mezzanine CMS, just haven't done so yet.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM