8a4979982d
[1mindex e1b1781..8767af7 100644[m [1m--- a/mamweb/settings.py[m [1m+++ b/mamweb/settings.py[m [36m@@ -22,9 +22,13 @@[m [mALLOWED_HOSTS = ['127.0.0.1'][m # https://docs.djangoproject.com/en/1.7/ref/settings/#databases[m [m DATABASES = {[m [31m- 'default': {[m [31m- 'ENGINE': 'django.db.backends.sqlite3',[m [31m- 'NAME': os.path.join(BASE_DIR, 'db-local.sqlite3'),[m [31m- }[m [32m+[m[32m 'default': {[m [32m+[m[32m 'ENGINE': 'django.db.backends.postgresql_psycopg2',[m [32m+[m[32m 'NAME': 'mam-prod',[m [32m+[m[32m 'USER': 'mam',[m [32m+[m[32m 'TEST': {[m [32m+[m[32m 'NAME': 'mam-test',[m [32m+[m[32m }[m [32m+[m[32m }[m }[m [m [1mdiff --git a/mamweb/settings.py b/mamweb/settings.py[m [1mindex e1b1781..8767af7 100644[m [1m--- a/mamweb/settings.py[m [1m+++ b/mamweb/settings.py[m [36m@@ -22,9 +22,13 @@[m [mALLOWED_HOSTS = ['127.0.0.1'][m # https://docs.djangoproject.com/en/1.7/ref/settings/#databases[m [m DATABASES = {[m [31m- 'default': {[m [31m- 'ENGINE': 'django.db.backends.sqlite3',[m [31m- 'NAME': os.path.join(BASE_DIR, 'db-local.sqlite3'),[m [31m- }[m [32m+[m[32m 'default': {[m [32m+[m[32m 'ENGINE': 'django.db.backends.postgresql_psycopg2',[m [32m+[m[32m 'NAME': 'mam-prod',[m [32m+[m[32m 'USER': 'mam',[m [32m+[m[32m 'TEST': {[m [32m+[m[32m 'NAME': 'mam-test',[m [32m+[m[32m }[m [32m+[m[32m }[m }[m [m |
||
---|---|---|
dakosdump | ||
mamweb | ||
seminar | ||
.gitignore | ||
backup_prod_db.sh | ||
diff_db_backup.sh | ||
Makefile | ||
manage.py | ||
README.md | ||
requirements.txt |
Basic commands for web development
After you clone this repository, run make
. It will download, locally install
and setup virtualenv and pip, and then locally install all required packages
from requirements.txt
.
When working with the code, always use the binaries in ./bin/
, such as
bin/pip
, bin/python
, ... never the global python, pip, ...
Use make
and ./manage.py
for most things.
Use git :-)
Quickstart
Install the following packages in Debian/Ubuntu: libpq-dev python-dev python-setuptools python2.7 libjpeg-dev libpng12-dev
. Then run:
make ./manage.py testdata make run
Make commands
-
make install
(ormake
) - locally install and setup virtualpy, install required packages. Ran again installs missing packages. Run after changingrequirements.txt
. -
make clean
- remove local python packages. -
make veryclean
- remove local packages and virtualpy enviroment and binaries. -
make run
- runs "./manage.py runserver_plus" -
make push_test
- pushes the last commited version to test location. Only git-commited changes are pushed! Rest is re-generated from scratch. At test server, the media data and database are kept the same. Everything else not in .gitignore is deleted/overwritten on the test server. -
make schema
- generates graph of seminar and all schemas as PDF. Supercool!
./manage.py commands
-
./manage.py migrate
- update the database schema, initialise the database. You need to run this in the beginning. -
./manage.py runserver_plus
- run a debugging server for the web. Slightly enhanced compared to./manage.py runserver
. Open 127.0.0.1:8000. -
./manage.py testdata
- create pseudo-random seminar data and admin/admin user. -
./manage.py test
- run the tests.
Configurations
mamweb/settings_common.py
contains most configuration options.mamweb/settings.py
is used only for local development.mamweb/settings_test.py
is used for testing on atrey.mamweb/settings_prod.py
is used in production deployment.
These are automatically switched by make
.