Skip to main content

Django-Frontier

Github Build Status Build Issues Build Forks

The django front-end scaffold tool you requested.

Tired of always having to setup your front end apps (react, vue, bootstrap tailwindcss) for your django projects, not any more. Every django developer knows how annoying it is to setup a front end for your django apps with the latest and greatest frontend frameworks, with django-frontier you get to set up your frontend scaffold with a single command. A breeze 😇


Before you install

Before you install django-frontier, please make sure you have python installed and you have a working django project either with with your local python installation or a virtual environment. We recommend the latter

Installation guide

  1. Open your terminal and install the django-frontier package using pip
$ pip install django-frontier
  1. After the installation, add the ‘frontier’ app to the INSTALLED_APPS of your django project settings
INSTALLED_APPS = [
    ...
    'frontier',
    ...
]
  1. Now you can use the frontier command by navigating to the root of your project directory, where ‘manage.py’ file is and run the frontier with either preset (vue, react, tailwind, or bootstrap)

for example, a react scaffold looks like this:

$ python manage.py frontier react

This generates a resources directory with your react application scaffold. Your directory structure looks like this:

your_project/
    resources/
        js/
            App.js
            index.js
            components/
                Example.js
    manage.py
    webpack.mix.js
    package.json
    .babelrc

    ...
  1. Configure your static assets by editing webpack.mix.js file.
const mix = require('laravel-mix');

mix.js('resources/js/index.js', 'static/').react();

NOTE: django-frontier uses laravel-mix js <https://laravel-mix.com>_ to compile and bundle all of it assets. You can read more about laravel mix <https://laravel-mix.com>_ on thier website

  1. You can then compile your assets by running
$ npm run watch

This spits out the complied assets in a static/ directory at the root of your project

static/
      js/
        index.js
        index.map.js
      css/
        index.css
        index.map.css

You can modify the output of the compiled assets in your ‘webpack.mix.js’ file.

  1. After compilation, setup your STATIC_URL and STATICFILES_DIRS in your django project settings.
# settings.py
STATIC_URL = '/static/'
STATICFILES_DIRS = [BASE_DIR / 'static/'] #new in django 3.0 which uses pathlib module
  1. Setup your template
<!DOCTYPE html>
{% load static %}
<html>
	<head>
		...
		<!-- if your dist folder includes css files -->
		<link rel="stylesheet" href="{% static 'css/index.css' %}" />
		...
	</head>
	<body>
		<!-- for your react / vue app, set up to include the compiled js files -->
		<div id="app"></div>
		<script src="{% static 'js/index.js' %}"></script>
	</body>
</html>
  1. For production, run the build command to minify the js and css for a smaller bundle
$ npm run build

MORE: Run the frontier command with -h flag for help and more options

$ python manage.py frontier -h

Enjoy 😇

Metadata

Release files for django-frontier 0.5.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-frontier 0.5.4
File Size Uploaded Provenance Actions
django-frontier-0.5.4.tar.gz 15.0 kB Without provenance Details for django-frontier-0.5.4.tar.gz

Release files / django-frontier-0.5.4.tar.gz

Download URL django-frontier-0.5.4.tar.gz
Size 15.0 kB
Tags Source
SHA-256 checksum
How to use checksums
2b9e3cb9b0a770e1f54a5ad2e9c7ec68a70bdf78f173c476e008954f518a460a
BLAKE2b-256 checksum
How to use checksums
1f3da1628846944dc3fbc76416dd963f8e9a5760d35742494dd7af39e639fcaa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.2

Security for django-frontier 0.5.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page