diff --git a/.gitignore b/.gitignore index fde52645cf467d6cbb4a2211d0b0b25392149c5e..b2d6c1a862a5b818851738c9bdc95b57ab13e8fd 100644 --- a/.gitignore +++ b/.gitignore @@ -65,3 +65,8 @@ tests/.hitch mailhog *.sqlite3 + +music +media +staticfiles +static diff --git a/config/settings/common.py b/config/settings/common.py index ceee21f9467a615b976ced99fa742518ca698000..5c55dfdc164fee32b469a1b3ce2c2ccb514979a0 100644 --- a/config/settings/common.py +++ b/config/settings/common.py @@ -199,7 +199,7 @@ CRISPY_TEMPLATE_PACK = 'bootstrap3' STATIC_ROOT = str(ROOT_DIR('staticfiles')) # See: https://docs.djangoproject.com/en/dev/ref/settings/#static-url -STATIC_URL = '/static/' +STATIC_URL = env("STATIC_URL", default='/static/') # See: https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#std:setting-STATICFILES_DIRS STATICFILES_DIRS = ( diff --git a/demo/demo-user.py b/demo/demo-user.py new file mode 100644 index 0000000000000000000000000000000000000000..64f48f9aa06bb9cb406306929d975025ad440c9b --- /dev/null +++ b/demo/demo-user.py @@ -0,0 +1,6 @@ +from funkwhale_api.users.models import User + + +u = User.objects.create(email='demo@demo.com', username='demo', is_staff=True) +u.set_password('demo') +u.save() diff --git a/demo/load-demo-data.sh b/demo/load-demo-data.sh new file mode 100755 index 0000000000000000000000000000000000000000..c09c5075e8b1bdd19b9260d96439704b74f6b2da --- /dev/null +++ b/demo/load-demo-data.sh @@ -0,0 +1,13 @@ +#! /bin/bash + +echo "Loading demo data..." + +python manage.py migrate --noinput + +echo "Creating demo user..." + +cat demo/demo-user.py | python manage.py shell --plain + +echo "Importing demo tracks..." + +python manage.py import_files "/music/**/*.ogg" --recursive --noinput diff --git a/dev.yml b/dev.yml index 7be203a49c3b7440201f94c851c7708058f06716..f347d00217be5cbbeb35f7fde9d2d7324b368683 100644 --- a/dev.yml +++ b/dev.yml @@ -4,10 +4,6 @@ services: postgres: env_file: .env image: postgres - volumes: - # If you are using boot2docker, postgres data has to live in the VM for now until #581 is fixed - # for more info see here: https://github.com/boot2docker/boot2docker/issues/581 - - /data/dev/funkwhale_api/postgres:/var/lib/postgresql/data redis: env_file: .env @@ -37,8 +33,6 @@ services: - .:/app ports: - "12081" - environment: - - USE_SAMPLE_TRACK=true links: - postgres - redis diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..4f79eb301b1241c91573c7e4d34d70686f82e7c2 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,42 @@ +version: '2' +services: + postgres: + image: postgres:9.5 + + api: + build: . + links: + - postgres + - redis + command: ./compose/django/gunicorn.sh + env_file: .env + volumes: + - ./media:/app/funkwhale_api/media + - ./staticfiles:/app/staticfiles + - ./music:/music + ports: + - "127.0.0.1:6001:5000" + + redis: + image: redis:3.0 + + celeryworker: + build: . + env_file: .env + links: + - postgres + - redis + command: celery -A funkwhale_api.taskapp worker -l INFO + volumes: + - ./media:/app/funkwhale_api/media + - ./music:/music + environment: + - C_FORCE_ROOT=True + + celerybeat: + build: . + env_file: .env + links: + - postgres + - redis + command: celery -A funkwhale_api.taskapp beat -l INFO