Skip to content

Commit

Permalink
Merge pull request #1429 from FJNR-inc/develop
Browse files Browse the repository at this point in the history
Release 4.0.0
  • Loading branch information
RignonNoel authored May 27, 2022
2 parents 3e363f1 + 7ba109c commit 82a0804
Show file tree
Hide file tree
Showing 134 changed files with 8,829 additions and 720 deletions.
13 changes: 9 additions & 4 deletions .env.docker
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
## Docker database
DATABASE_URL=postgres://root:my_password@db:5432/blitz
DB_HOST=db
DB_USER=root
DB_PASSWORD=my_password
DB_PORT=5432
DB_NAME=blitz

## GENERAL SETTINGS
DEBUG=True
SECRET_KEY=NSH1FNjqRuZCZA2MxM7pNSH1FNjqRuZCZA2MxM7p
ALLOWED_HOSTS=127.0.0.1, localhost, 0.0.0.0
#ADMINS=("You", "you@example.com"),
ALLOWED_HOSTS=127.0.0.1,localhost,0.0.0.0
MAILCHIMP_API_KEY=00000000000000000000000000000000-aa00 #fake key
MAILCHIMP_SUBSCRIBE_LIST_ID=1
MAILCHIMP_ENABLED=False
MAILCHIMP_ENABLED=False

EMAIL_SERVICE=True
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ coverage.xml

# Translations
*.mo
*.pot

# Django stuff:
*.log
Expand Down Expand Up @@ -86,6 +85,7 @@ celerybeat-schedule
.venv
venv/
ENV/
ve/

# Spyder project settings
.spyderproject
Expand Down
14 changes: 8 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ before_script:
# We will run a postgres service into docker, so wee need to stop the postgres service
- sudo service postgresql stop
script:
- docker-compose run api coverage run manage.py test
- docker-compose run api pycodestyle --config=.pycodestylerc .
after_success:
- docker-compose run -e TRAVIS_JOB_ID -e TRAVIS_BRANCH -e TRAVIS api coveralls
Expand All @@ -34,9 +33,9 @@ env:
- ORGANIZATION=Blitz Paradisio
- EMAIL_SERVICE=True
- AUTO_ACTIVATE_USER=False
- ACTIVATION_URL=https://da6gat167y18o.cloudfront.net/membership/confirmation/{{token}}
- FORGOT_PASSWORD_URL=https://da6gat167y18o.cloudfront.net/reset-password/{{token}}
- RETREAT_UNSUBSCRIBE_URL=https://da6gat167y18o.cloudfront.net/wait_queue/{{wait_queue_id}}/unsubscribe
- ACTIVATION_URL=https://dev.thesez-vous.org/membership/confirmation/{{token}}
- FORGOT_PASSWORD_URL=https://dev.thesez-vous.org/reset-password/{{token}}
- RETREAT_UNSUBSCRIBE_URL=https://dev.thesez-vous.org/wait_queue/{{wait_queue_id}}/unsubscribe
- AWS_S3_REGION_NAME=ca-central-1
- AWS_STORAGE_STATIC_BUCKET_NAME=thesezvous-api-static
- AWS_STORAGE_MEDIA_BUCKET_NAME=thesezvous-api-media-dev
Expand All @@ -47,8 +46,11 @@ env:
- MEDIA_URL=https://thesezvous-api-media-dev.s3.ca-central-1.amazonaws.com/
- MEDIA_ROOT=https://thesezvous-api-media-dev.s3.ca-central-1.amazonaws.com/
- DEFAULT_FILE_STORAGE=blitz_api.storage_backends.S3MediaStorage
- CONFIRM_SIGN_UP=6
- FORGOT_PASSWORD=7
- CONFIRM_SIGN_UP=36,
- FORGOT_PASSWORD=40,
- TEMPLATE_EMAIL_THROWBACK_VIRTUAL_RETREAT=43,
- TEMPLATE_EMAIL_REMINDER_VIRTUAL_RETREAT=41,
- TEMPLATE_EMAIL_WELCOME_VIRTUAL_RETREAT=42,
- EMAIL_BACKEND=anymail.backends.sendinblue.EmailBackend
- DEFAULT_FROM_EMAIL=noreply@thesezvous.org
- PAYSAFE_BASE_URL=https://api.test.paysafe.com/
Expand Down
62 changes: 62 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
pipeline {
agent {
docker {
image 'tmaier/docker-compose'
args '-v /var/run/docker.sock:/var/run/docker.sock'
}
}
environment {
HOME = '.'
}
stages {
stage('Debug info') {
steps {
sh 'docker-compose --version'
}
}
stage('Build images') {
steps {
sh 'docker-compose build'
}
}
stage('Static code analysis') {
steps {
sh 'docker-compose run --rm api pycodestyle --config=.pycodestylerc .'
}
}
stage('Unit tests') {
steps {
sh 'docker-compose run --rm api python manage.py test'
}
}
stage('deploy QA') {
when{
expression {
return env.BRANCH_NAME == 'develop';
}
}
steps {
sh '''
# No deploy QA
'''
}
}
stage('Store official image') {
when{
expression {
return env.BRANCH_NAME == 'master';
}
}
steps {
sh '''
# No image repository
'''
}
}
stage("Final Cleanup") {
steps {
cleanWs deleteDirs: true, notFailBuild: true
}
}
}
}
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,22 @@ Feel free to create an account there to begin contributing!

---

# Command to work

## Generation of POT file

Translation are done with Weblate on our [own instance](https://weblate.fjnr.ca).

We do not create or update `*.po` file inside the repository but ONLY via weblate interface.

To refresh the list of translation string (`*.pot`) please just execute this command below, it will prepare the `*.pot` file, that is a template used for every languages in Weblate. (locale `fr` is specified because we are obliged to set one, but it will do all the languages)

```bash
docker-compose run --rm api python manage.py makemessages --locale fr --keep-pot
```

---

# Quickstart

We're going to install and configure the latest develop build of this API.
Expand Down
7 changes: 7 additions & 0 deletions blitz_api/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from __future__ import absolute_import, unicode_literals

# This will make sure the app is always imported when
# Django starts so that shared_task will use this app.
from .celery import app as celery_app

__all__ = ('celery_app',)
21 changes: 20 additions & 1 deletion blitz_api/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,26 @@ class CustomUserAdmin(UserAdmin, SimpleHistoryAdmin, ExportActionModelAdmin):
""" Required to display extra fields of users in Django Admin """
resource_class = UserResource
form = CustomUserChangeForm
search_fields = ['first_name', 'last_name', 'email', 'id']
search_fields = [
'first_name',
'last_name',
'email',
'id',
]
list_filter = (
'membership',
'university',
'is_staff',
'is_superuser',
'is_active',
)
list_display = (
'username',
'first_name',
'last_name',
'membership',
'is_staff',
)

def __init__(self, *args, **kwargs):
super(CustomUserAdmin, self).__init__(*args, **kwargs)
Expand Down
18 changes: 18 additions & 0 deletions blitz_api/asgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"""
ASGI config for Blitz-API project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/
"""

import os

from django.core.asgi import get_asgi_application
from websocket.middleware import websockets

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'blitz_api.settings')

application = get_asgi_application()
application = websockets(application)
23 changes: 23 additions & 0 deletions blitz_api/celery.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""
Celery config file
https://docs.celeryproject.org/en/stable/django/first-steps-with-django.html
"""

from __future__ import absolute_import
import os
from celery import Celery

# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'blitz_api.settings')
app = Celery('blitz_api')

# Using a string here means the worker will not have to
# pickle the object when using Windows.

app.config_from_object('django.conf:settings', namespace='CELERY')

app.conf.beat_schedule = {
# Add some schedule tasks here if you need
}

app.autodiscover_tasks()
Empty file added blitz_api/locale/__init__.py
Empty file.
Loading

0 comments on commit 82a0804

Please sign in to comment.