Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/allcaps/django-scaffold
Django build command to generate your app
https://github.com/allcaps/django-scaffold
Last synced: 13 days ago
JSON representation
Django build command to generate your app
- Host: GitHub
- URL: https://github.com/allcaps/django-scaffold
- Owner: allcaps
- License: mit
- Created: 2016-11-11T15:03:59.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2019-04-27T22:59:01.000Z (over 5 years ago)
- Last Synced: 2024-11-11T11:03:45.493Z (2 months ago)
- Language: HTML
- Size: 39.1 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.txt
- License: LICENSE
Awesome Lists containing this project
README
Django Scaffold
===============Django Scaffold provides a build command to inspect models and generate views, urls, templates, admin etc.
Install
-------env/bin/pip install -e [email protected]:allcaps/django-scaffold.git#egg=django-scaffold
Usage
-----Django Scaffold does introspection of `models.py`. Create a your webapp and compose your models.
Alternatively you can inspect an existing database with the
[inspectdb command](https://docs.djangoproject.com/en/1.10/howto/legacy-databases/).Make sure both your app and `scaffold` are in `INSTALLED_APPS`:
INSTALLED_APPS = [
'your_app',
'scaffold',
...
]The `build` command generates admin, views, urls, templates and writes them to your app:
python manage.py build your_app
After the build
---------------# settings.py
SITE_ID = 1
TEMPLATES[0]['OPTIONS']['context_processors'] += ['webapp.context_processors.base']
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static/')
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')INSTALLED_APPS += ['django.contrib.sites']
# models.py
from model_mixins import BaseMixin
# For each model in models add BaseMixin:
class Foo(BaseMixin, models.Model):Creating your own scaffold
--------------------------Make sure your app comes before `scaffold`. This makes Django find your template overrides first.
Copy the scaffold template to your_app/templates/scaffold to customise them:
cp path/to/site-packages/scaffold/templates/scaffold your_app/templates/
Some ideas
----------- Override the django template processor to make a second template language to make 'template tempelates' more readable.
- Create settings for Single and Multiple generator template names. So it is easy to customize the template sets.
- Template packages (minimal, Bootstrap, REST API, CRUD, Wagtail).
- Add get_admin_url and add admin edit buttons on page when user has access to admin.
- Add instructions.html template to display in terminal.
- Add rollback option or alternatively warn when project is not a clean checkout.