This is an opinionated bootstrap repository for Django with Angular
- ensure Docker and Docker Compose are installed (https://docs.docker.com/compose/install/)
- check that no other docker containers are blocking ports 3000, 8000 or 9000
- run
make firstrun
- this will download and build all necessary docker images, runs migrations and initiate django development server - in new terminal window run
make dev
that starts a webpack development server with hot reload (which proxies requests to django server) - the development is then done on http://localhost:3000
- based on Django Rest Framework
- django-rest-auth is used for the authentization (with JWT tokens)
- it is possible to see the definition of all the endpoints on http://localhost:9000
- however, note that this is only possible thanks to @swagger_permissions decorator, which is necessary to use with every protected view
- future use - it should be possible to generate Angular services based on auto-generated swagger file
- Unfortunately, this is not currently possible due to the following issue: (marcgibbons/django-rest-swagger#549)
- django-rest-auth implementation
- interceptors are used for sending JWT tokens
- the app is based around ngrx (upgrade to v4 coming soon)
- the app is derived from the project angular-webpack2-starter
- for the e2e testing, docker image webnicer/protractor-headless is used
- pug files can be used instead of html files
- why docker?
- all team members have identical development environment
- easy continuous integration / deployment strategies with tools, such as Drone
- easy production setup with Docker Swarm
-
why make commands?
-
less writing, really. Compare
make dev
vsdocker exec -it django-angular-client yarn run start:inline
-
the commands are defined in build/makefiles directory and aggregated in Makefile file
-
firstrun
- turns on docker containers, run migrations and starts development server -
composeup
- turns on docker containers
makemigrations
- runs django makemigrationsmigrate
- runs django migrationsinitdata
- loads initial data to database - development onlyrunserver
- runs django development servershell
- gets you into the django shellrunswagger
- swagger definition is accessible on localhost:9000
dev
- runs webpack development server with hot reloadwatchaot
- recompiles typescript files upon change with AOTetest
- runs end-to-end testutest
- runs unit testyarn
- runs yarnyarnupgrade
- runs yarn upgradermyarn
- removes node_modulesrefreshyarn
- removes node_modules and runs yarn
genswagger
- generates swagger file based on django modelstsgen
- generates angular interfaces and services based on previously generated swagger file. Please note the generated services are currently not usable (for Angular 4.3+)
buildpostgres
- builds postgres imagebuildpostgis
- builds postgis imagebuildserver
- build django server image - for development onlybuildgeosserver
- build django server where geo django can be enabled - for development onlybuildclient
- build client imageprune
- removes unused images and containers
- this project is based on the angular-webpack2-starter project (https://github.com/qdouble/angular-webpack2-starter)
- The project on which the project is based on, angular-webpack2-starter project, is licensed under MIT
- Also, password equality directive is based on https://github.com/NetanelBasal/ngx-text-equality-validator, licensed under the ISC license
- This repository is licensed under MIT