Search code examples
djangoubuntumezzaninelinode

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?


Solution

  • 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)