diff --git a/.gitignore b/.gitignore index 36ce474..bcb3339 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,4 @@ supervisord.log supervisord.pid keys.py .DS_Store -pickmybruin*.sql +bquest*.sql diff --git a/Makefile b/Makefile index 027ec95..3f1b8dc 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ default: build clean: build: - docker build -t pickmybruin/backend . + docker build -t bquest/backend . run: -pkill docker-compose @@ -13,17 +13,17 @@ restart: docker-compose restart web ssh: - docker exec -i -t `docker ps -q --filter status=running --filter ancestor=pickmybruin/backend:latest` /bin/bash + docker exec -i -t `docker ps -q --filter status=running --filter ancestor=bquest/backend:latest` /bin/bash # usage: make run_command cmd="echo hi" run_command: - docker exec -i -t `docker ps -q --filter status=running --filter ancestor=pickmybruin/backend:latest` /bin/bash -c "$(cmd)" + docker exec -i -t `docker ps -q --filter status=running --filter ancestor=bquest/backend:latest` /bin/bash -c "$(cmd)" shell: - docker exec -i -t `docker ps -q --filter status=running --filter ancestor=pickmybruin/backend:latest` /bin/bash -c "/code/src/manage.py shell_plus" + docker exec -i -t `docker ps -q --filter status=running --filter ancestor=bquest/backend:latest` /bin/bash -c "/code/src/manage.py shell_plus" test: - docker exec -i -t `docker ps -q --filter status=running --filter ancestor=pickmybruin/backend:latest` /bin/bash -c "cd /code/src && ./manage.py test --no-input --parallel $(args)" + docker exec -i -t `docker ps -q --filter status=running --filter ancestor=bquest/backend:latest` /bin/bash -c "cd /code/src && ./manage.py test --no-input --parallel $(args)" clean_db: docker-compose exec db psql -U postgres -c 'DROP SCHEMA public CASCADE; CREATE SCHEMA public;' @@ -35,12 +35,12 @@ init_db: clean_db restore-db: backup_db: - docker exec -t `docker ps -q --filter status=running --filter ancestor=postgres:10.1-alpine` pg_dumpall -c -U postgres > pickmybruin_dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql + docker exec -t `docker ps -q --filter status=running --filter ancestor=postgres:10.1-alpine` pg_dumpall -c -U postgres > bquest_dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql save_requirements: - docker exec -i -t `docker ps -q --filter status=running --filter ancestor=pickmybruin/backend:latest` /bin/bash -c "pip3 freeze" | tail -n +2 > requirements.txt + docker exec -i -t `docker ps -q --filter status=running --filter ancestor=bquest/backend:latest` /bin/bash -c "pip3 freeze" | tail -n +2 > requirements.txt install_package: - docker exec -i -t `docker ps -q --filter status=running --filter ancestor=pickmybruin/backend:latest` /bin/bash -c "pip3 install $(pkg)" - docker exec -i -t `docker ps -q --filter status=running --filter ancestor=pickmybruin/backend:latest` /bin/bash -c "pip3 freeze" | tail -n +2 > requirements.txt + docker exec -i -t `docker ps -q --filter status=running --filter ancestor=bquest/backend:latest` /bin/bash -c "pip3 install $(pkg)" + docker exec -i -t `docker ps -q --filter status=running --filter ancestor=bquest/backend:latest` /bin/bash -c "pip3 freeze" | tail -n +2 > requirements.txt diff --git a/README.md b/README.md index dec05fb..beaf294 100644 --- a/README.md +++ b/README.md @@ -13,11 +13,11 @@ Simplified tree diagram ``` /usr/bin/tree . # Contains docker setup and Makefile ├── docker-compose.yml # defines setup of PostgreSQL and Django -├── Dockerfile # defines pickmybruin/backend Docker image +├── Dockerfile # defines bquest/backend Docker image ├── initialize.sh # sets up Django container (runs migrations and then boots server) ├── Makefile # contains very useful helper commands └── src # Contains all Django code - ├── pickmybruin # Contains code relating to the entire website + ├── bquest # Contains code relating to the entire website │   ├── keys.py # put confidential info in here │   ├── settings.py # global settings (please keep confidential info out of here) │   ├── urls.py # global URLs (usually imports app URLs too) @@ -31,7 +31,7 @@ Simplified tree diagram ``` ## Makefile commands -- `make build` creates the `pickmybruin/backend` image +- `make build` creates the `bquest/backend` image - `make run` starts up the PostgreSQL and Django containers - `make restart` restarts the Django container (useful when you edit code) - `make ssh` starts a bash session in the latest Django container @@ -44,12 +44,12 @@ Simplified tree diagram ## How to add a new app 1. Run `make run_command cmd="src/manage.py startapp $APPNAME` - This creates a new skeleton folder for your new app -2. YOU MUST ADD THIS APP TO `src/pickmybruin/settings.py` `INSTALLED_APPS` FOR THE APP TO BE DISCOVEREDR +2. YOU MUST ADD THIS APP TO `src/bquest/settings.py` `INSTALLED_APPS` FOR THE APP TO BE DISCOVEREDR - `'users',` adds the `users` app to the Django project. Big surprise. 3. Add your code 4. Add tests to `tests.py` 5. Add your models to `admin.py` -6. Import your urls.py in `src/pickmybruin/urls.py` +6. Import your urls.py in `src/bquest/urls.py` 7. Run the tests 8. Submit a PR diff --git a/docker-compose.yml b/docker-compose.yml index 89fddcf..44d08d1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,12 +4,12 @@ services: db: image: postgres:10.1-alpine websockets: - image: pickmybruin/websockets:latest + image: bquest/websockets:latest build: websockets ports: - "8001:80" web: - image: pickmybruin/backend:latest + image: bquest/backend:latest build: . command: bash initialize.sh environment: diff --git a/init_db.sql b/init_db.sql index 775c29c..4013e97 100644 --- a/init_db.sql +++ b/init_db.sql @@ -979,7 +979,7 @@ COPY oauth2_provider_accesstoken (id, token, expires, scope, application_id, use -- COPY oauth2_provider_application (id, client_id, redirect_uris, client_type, authorization_grant_type, client_secret, name, user_id, skip_authorization, created, updated) FROM stdin; -1 web confidential password sMXrq4RV2muu07ERhrllW1uCfH12U4ZNeqyM0L8bmaF9P59prjkIe5mhJJAt47Kod14yhRdg96gEf1m183sblRzyC175eLd7NzsyWS9w6QTyVPdczvTmeHiGBJJPjhGf pickmybruin web access \N f 2017-10-26 00:16:28.897+00 2017-11-02 07:56:52.99572+00 +1 web confidential password sMXrq4RV2muu07ERhrllW1uCfH12U4ZNeqyM0L8bmaF9P59prjkIe5mhJJAt47Kod14yhRdg96gEf1m183sblRzyC175eLd7NzsyWS9w6QTyVPdczvTmeHiGBJJPjhGf bquest web access \N f 2017-10-26 00:16:28.897+00 2017-11-02 07:56:52.99572+00 \. diff --git a/initialize.sh b/initialize.sh index bcaecf7..a82861c 100755 --- a/initialize.sh +++ b/initialize.sh @@ -4,9 +4,9 @@ -if [ ! -f src/pickmybruin/keys.py ]; then - echo "SECRET_KEY = '"$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)"'" > src/pickmybruin/keys.py - echo $(pwd)"/src/pickmybruin/keys.py generated" +if [ ! -f src/bquest/keys.py ]; then + echo "SECRET_KEY = '"$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)"'" > src/bquest/keys.py + echo $(pwd)"/src/bquest/keys.py generated" fi diff --git a/src/pickmybruin/__init__.py b/src/bquest/__init__.py similarity index 100% rename from src/pickmybruin/__init__.py rename to src/bquest/__init__.py diff --git a/src/pickmybruin/middleware.py b/src/bquest/middleware.py similarity index 100% rename from src/pickmybruin/middleware.py rename to src/bquest/middleware.py diff --git a/src/pickmybruin/settings.py b/src/bquest/settings.py similarity index 95% rename from src/pickmybruin/settings.py rename to src/bquest/settings.py index 9f84c0b..834974a 100644 --- a/src/pickmybruin/settings.py +++ b/src/bquest/settings.py @@ -1,5 +1,5 @@ """ -Django settings for pickmybruin project. +Django settings for bquest project. For more information on this file, see https://docs.djangoproject.com/en/1.6/topics/settings/ @@ -64,9 +64,9 @@ 'corsheaders.middleware.CorsMiddleware', ) -ROOT_URLCONF = 'pickmybruin.urls' +ROOT_URLCONF = 'bquest.urls' -WSGI_APPLICATION = 'pickmybruin.wsgi.application' +WSGI_APPLICATION = 'bquest.wsgi.application' # Database @@ -113,7 +113,7 @@ AWS_S3_OBJECT_PARAMETERS = { 'CacheControl': 'max-age=86400', } -DEFAULT_FILE_STORAGE = 'pickmybruin.storage_backends.MediaStorage' +DEFAULT_FILE_STORAGE = 'bquest.storage_backends.MediaStorage' DATA_UPLOAD_MAX_NUMBER_FIELDS = None # ignores number of parameters sent TEMPLATES = [ @@ -148,7 +148,7 @@ ], 'DEFAULT_AUTHENTICATION_CLASSES': ( 'rest_framework.authentication.BasicAuthentication', - 'pickmybruin.middleware.CsrfExemptSessionAuthentication', + 'bquest.middleware.CsrfExemptSessionAuthentication', ), 'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination', 'PAGE_SIZE': 100, diff --git a/src/pickmybruin/storage_backends.py b/src/bquest/storage_backends.py similarity index 100% rename from src/pickmybruin/storage_backends.py rename to src/bquest/storage_backends.py diff --git a/src/pickmybruin/urls.py b/src/bquest/urls.py similarity index 100% rename from src/pickmybruin/urls.py rename to src/bquest/urls.py diff --git a/src/pickmybruin/wsgi.py b/src/bquest/wsgi.py similarity index 72% rename from src/pickmybruin/wsgi.py rename to src/bquest/wsgi.py index 6ed5f72..2740a80 100644 --- a/src/pickmybruin/wsgi.py +++ b/src/bquest/wsgi.py @@ -1,5 +1,5 @@ """ -WSGI config for pickmybruin project. +WSGI config for bquest project. It exposes the WSGI callable as a module-level variable named ``application``. @@ -8,7 +8,7 @@ """ import os -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pickmybruin.settings") +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bquest.settings") from django.core.wsgi import get_wsgi_application application = get_wsgi_application() diff --git a/src/email_requests/serializers.py b/src/email_requests/serializers.py index 0dcb5f7..f2f02e1 100644 --- a/src/email_requests/serializers.py +++ b/src/email_requests/serializers.py @@ -14,4 +14,4 @@ class RequestSerializer(WritableNestedModelSerializer): class Meta: model = Request fields = ('mentee', 'mentor', 'email_body', 'preferred_mentee_email', 'phone', 'date_created',) - read_only_fields = ('mentee', 'mentor', 'email_body', 'preferred_mentee_email', 'phone', 'date_created',) \ No newline at end of file + read_only_fields = ('mentee', 'mentor', 'email_body', 'preferred_mentee_email', 'phone', 'date_created',) diff --git a/src/email_requests/views.py b/src/email_requests/views.py index bd103f5..66643a0 100644 --- a/src/email_requests/views.py +++ b/src/email_requests/views.py @@ -7,7 +7,7 @@ from users.models import Profile, Mentor, User from .models import Request from rest_framework import generics -from pickmybruin.settings import REQUEST_TEMPLATE +from bquest.settings import REQUEST_TEMPLATE import sendgrid from sendgrid.helpers.mail import Email, Content, Substitution, Mail diff --git a/src/manage.py b/src/manage.py index 4ce6dd5..ab1a266 100755 --- a/src/manage.py +++ b/src/manage.py @@ -3,7 +3,7 @@ import sys if __name__ == "__main__": - os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pickmybruin.settings") + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bquest.settings") from django.core.management import execute_from_command_line diff --git a/src/messaging/admin.py b/src/messaging/admin.py index 5efafc5..3ee7331 100644 --- a/src/messaging/admin.py +++ b/src/messaging/admin.py @@ -11,4 +11,4 @@ class MessageAdmin(admin.ModelAdmin): @admin.register(models.Thread) class ThreadAdmin(admin.ModelAdmin): - pass \ No newline at end of file + pass diff --git a/src/messaging/factories.py b/src/messaging/factories.py index ed62c18..8b172a4 100644 --- a/src/messaging/factories.py +++ b/src/messaging/factories.py @@ -15,4 +15,4 @@ class Meta: model = models.Message thread = factory.SubFactory(ThreadFactory) sender = factory.SelfAttribute('thread.profile_1') - \ No newline at end of file + diff --git a/src/messaging/views.py b/src/messaging/views.py index 3a1805b..2e6a0dd 100644 --- a/src/messaging/views.py +++ b/src/messaging/views.py @@ -8,7 +8,7 @@ from users.models import Profile, User from rest_framework import generics from rest_framework.views import APIView -from pickmybruin.settings import MESSAGING_TEMPLATE +from bquest.settings import MESSAGING_TEMPLATE import sendgrid from sendgrid.helpers.mail import Email, Content, Substitution, Mail diff --git a/src/users/urls.py b/src/users/urls.py index 2c4de5f..121c8c5 100644 --- a/src/users/urls.py +++ b/src/users/urls.py @@ -22,4 +22,4 @@ url(r'^verify_link/?$', views.ResendVerifyUser.as_view(), name='verify_link'), url(r'^password/?$', views.PasswordReset.as_view(), name='password_reset'), url(r'^password_link/?$', views.SendPasswordReset.as_view(), name='password_reset_link'), -] \ No newline at end of file +] diff --git a/src/users/views.py b/src/users/views.py index 26ce646..d4526c8 100644 --- a/src/users/views.py +++ b/src/users/views.py @@ -26,7 +26,7 @@ import sendgrid from sendgrid.helpers.mail import Email, Content, Substitution, Mail -from pickmybruin.settings import USER_VERIFICATION_TEMPLATE, PASSWORD_RESET_TEMPLATE +from bquest.settings import USER_VERIFICATION_TEMPLATE, PASSWORD_RESET_TEMPLATE class UserViewSet(viewsets.ModelViewSet): """