Start a django website

Posted under » Django on 23 April 2021

By now, you should have install venv and under this environment you have installed django.

First go to your webroot folder and

$ django-admin startproject students

If you intend to use apache then configure WSGI.

2nd you want to create a superuser.

While still under the venv environment, go the webroot folder

$ python manage.py createsuperuser

You may have this error so please comply.

You have 18 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run 'python manage.py migrate' to apply them.

You will be prompted for a username, an email address, and a password for your user.

Next we will migrate from SQLite to MySQL. You should already have installed MySQLclient. Create database and user. Add the mysql bit in settings.py.

$ sudo systemctl daemon-reload
$ sudo systemctl restart mysql

We need to verify that the configurations in Django detect your MySQL server properly. Run this.

$ python manage.py migrate

Now go the the website URL and see if everything works.

web security linux ubuntu python django git Raspberry apache mysql php drupal cake javascript css AWS IOT