Deploy our Django project on cloud - Part 2

DAY 2 - October 2018

Having a web admin interface in few lines of code (remember we just define an admin.py for our models + few configuration files). And this interface is mobile responsive (you can try to resize your browser and look at the result).
But we should go a step further and customize the interface using the wonderful plugin Django Jet.
To install it, just add:

django-jet

to the requirements.txt file and launch the command:

pip3 install requirements.txt

Then modify your settings.py file to add 'jet':

INSTALLED_APPS = (
    ...
    'jet',
    'django.contrib.admin',
    ...
)

And in you bikebackend/urls.py file:

from django.contrib import admin
from django.urls import path
from django.conf.urls import include
urlpatterns = [
    path('jet/', include('jet.urls', 'jet')),  # Django JET URLS
    path('admin/', admin.site.urls),
]

Now we can install the database tables that Jet will be using and collect the static files:

python3 manage.py migrate jet
								python3 manage.py collectstatic

Then if you relaunch your django server:

python3 manage.py runserver

You should see your new admin interface, you can even let your superuser choose his color by adding in the settings.py file:

JET_THEMES = [
    {
        'theme': 'default', # theme folder name
        'color': '#47bac1', # color of the theme's button in user menu
        'title': 'Default' # theme title
    },
    {
        'theme': 'green',
        'color': '#44b78b',
        'title': 'Green'
    },
    {
        'theme': 'light-green',
        'color': '#2faa60',
        'title': 'Light Green'
    },
    {
        'theme': 'light-violet',
        'color': '#a464c4',
        'title': 'Light Violet'
    },
    {
        'theme': 'light-blue',
        'color': '#5EADDE',
        'title': 'Light Blue'
    },
    {
        'theme': 'light-gray',
        'color': '#222',
        'title': 'Light Gray'
    }
]

Ok so now it's time to deploy on Clever cloud