This project shows various django-fluent modules, and possible code layout for inspiration of your own projects.
To build the container and run it:
docker-compose upAnd open http://localhost:8000/ Any e-mail that is sent can be seen at: http://localhost:8025/
Run the container:
kubectl apply -f k8s-app.ymlConnect an Ingres or NodePort service to the container port:
kubectl apply -f k8s-nodeport.yml
curl -v -H 'Host: demo.django-fluent.org' http://127.0.0.1:30000/en/And open http://localhost:30000/
To uninstall:
kubectl delete -f k8s-nodeport.yml
kubectl delete -f k8s-app.ymlBuild the container. and run it:
docker build -t fluentdemo .
docker run --rm -p 8080:8080 fluentdemoAnd open http://localhost:8080/
Some application settings can be overwritten by defining these environment variables (either in the shell, or in the docker/kubernetes configuration file)
ALLOWED_HOSTSA list of hostnames, or*for all.CACHE_URLto point to a cache server (memcached/redis, e.g.memcache://127.0.0.1:11211?TIMEOUT=86400&KEY_PREFIX=fluentdemo).CSRF_COOKIE_SECURETrue/FalseDATABASE_URLto point to a database (e.g.postgresql://user:pass@host/dbname).DJANGO_DEBUGTrue/FalseDJANGO_SECRET_KEYa custom secret keyDJANGO_SETTINGS_MODULEa custom settings module, defaults tofluentdemo.settings.env.docker.EMAIL_URLto point to an SMTP server (e.g.smtp+tls://hostname).GEOPOSITION_GOOGLE_MAPS_API_KEYAPI key for Google MapsGOOGLE_ANALYTICS_PROPERTY_IDGoogle Analytics ID to useSENTRY_DSNto point to an Sentry instanceSESSION_COOKIE_SECURETrue/FalseTHUMBNAIL_REDIS_URLURL to redis instance for thumbnails.UWSGI_PROCESSESThe number of processes that uWSGI must use.UWSGI_THREADSThe number of threads that uWSGI must use.
See django-environ for some examples for the DATABASE_URL, CACHE_URL and EMAIL_URL.
- Python >= 2.7
- pip
- virtualenv (virtualenvwrapper is recommended)
To setup a local development environment:
virtualenv env --prompt="(fluentdemo)" # or mkvirtualenv fluentdemo
source env/bin/activate
cd src
make install
./manage.py migrate
./manage.py runserverBy default, the database uses an SQLite file. PostgreSQL can be used instead:
cp fluentdemo/settings/local.py.example fluentdemo/settings/local.py # To enable debugging
edit fluentdemo/settings/local.py # define DATABASES or or `export DATABASE_URL=...`
sudo su - postgres
createuser fluentdemo -P # testtest is the default password
createdb --template=template0 --encoding='UTF-8' --lc-collate='en_US.UTF-8' --lc-ctype='en_US.UTF-8' --owner=fluentdemo fluentdemo
exit
./manage.py migrateSass files are compiled to CSS during the development. At the server, there is no need for installing development tools.
To setup your development system, install NodeJS from https://nodejs.org/.
On Mac OSX, you can also use brew install libsass node.
Run the following command to compile SASS files:
npm run gulp
This will compile the files, and watch for changes. It also has LiveReload support. Install a browser plugin from: http://livereload.com/extensions/ and toggle the "LiveReload" button in the browser to see CSS changes instantly.
Feel free to use parts of this code in your projects.
Except otherwise noted, this project is © 2016 Edoburu, under a Creative Commons Attribution 3.0 Unported License.
The django-fluent modules are licensed under the Apache License Version 2.0.