Django

Connecting Django to Jet Admin

To integrate Jet Admin with your Django project you need to install the Jet Bridge package. It will work even with your local application on localhost. Jet Bridge is an open-source plugin available on Github. It will connect to your database and link Jet Admin with your project.

This is the quickest way to install Jet Admin for Django based projects. Installed in the same way as most Django packages.

Requirements

  • Python 3.4+

  • Django 1.11+

  • localhost or web server with external IP

Installation

1. Download and install the latest version of Jet Bridge for Django:

pip install jet-django

3. Add jet_django application to the INSTALLED_APPS setting inside settings.py file (your Django project):

INSTALLED_APPS = ( ... 'jet_django', ...)

4. Set JET_PROJECT and JET_TOKEN inside settings.py file:

JET_PROJECT = '{{your_project_name}}'
JET_TOKEN = '{{your_jet_token}}'

Jet Token is automatically generated for each project, you can find it in the settings.

5. Add a URL-pattern to the urls.py file. Remember to import path and include:

urlpatterns = [ ... path('jet_api/', include('jet_django.urls')), ...]

If you use Django < 2.0:

urlpatterns = [ ... url(r'^jet_api/', include('jet_django.urls')), ...]

6. Run your Django server. Change into the outer your project directory, if you haven’t already, and run the following command:

py manage.py runserver

8. Finish installation by opening this link in your browser, where localhost is your Django HOST and 8000 is its PORT.

http://localhost:8000/jet_api/register/

Jet Django package sets CORS headers for /jet_api/ endpoints. If it conflicts with your CORS headers and you want to deal with it yourself, add the following in settings.py: JET_CORS_HEADERS = False

Common problems