Skip to content

Instantly share code, notes, and snippets.

View tchappui's full-sized avatar

Thierry Chappuis tchappui

View GitHub Profile
@tchappui
tchappui / README.md
Created September 19, 2021 21:50 — forked from 8area8/README.md
Django/Vue-cli coupling

Basic workflow to Django/Vue-cli coupling

The goal of this workflow is to couple vue-cli to Django, in a transparent way in dev and in prod. The hot-reload is active in the backend as well as in the frontend, and the frontend is accessed through Django, from the index page ;)

Note: We also use the router's historical mode, for a more professional integration.

Note²: Do not forget to build the vue-cli project for production!

Base

# import * from pygame
import env
from random import *
class World:
X_MIN = 0
X_MAX = env.MAP_WIDTH
Y_MIN = 0
Y_MAX = env.MAP_HEIGHT
@tchappui
tchappui / secret-key-gen.py
Created October 11, 2018 11:23 — forked from ndarville/secret-key-gen.py
Generating a properly secure SECRET_KEY in Django
"""
Two things are wrong with Django's default `SECRET_KEY` system:
1. It is not random but pseudo-random
2. It saves and displays the SECRET_KEY in `settings.py`
This snippet
1. uses `SystemRandom()` instead to generate a random key
2. saves a local `secret.txt`