Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,28 @@ jobs:
SECRET_KEY: BetPHpGoUXUwjaAXm6ArIhV95xLdDZtu8QEGnNXY3eTknIkD
AUTH_STAFF_EMAIL_DOMAINS: mozillafoundation.org
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: 3.7
- name: Install Python Dependencies
python-version: 3.11
- name: Write .env file with DATABASE_URL for CI
run: |
pip install -r requirements.txt -r dev-requirements.txt
echo "DATABASE_URL=postgres://postgres:postgres@localhost:5432/pulseapi" > .env
# Pillow requires libjpeg-dev, zlib1g-dev, etc. to build from source
- name: Install system dependencies for Pillow build
run: |
sudo apt-get update
sudo apt-get install -y libjpeg-dev zlib1g-dev libpng-dev
# setuptools >=66 removed `convert_path`, which breaks django-allauth 0.48.0
# See https://github.com/pypa/setuptools/issues/3772
- name: Install setuptools 65.5.1 for compatibility with django-allauth
run: pip install "setuptools==65.5.1"
- name: Install wheel for building packages like cffi
run: pip install wheel
- name: Install Python Dependencies (no build isolation)
run: |
pip install --no-binary psycopg2-binary psycopg2-binary
pip install --no-build-isolation -r requirements.txt -r dev-requirements.txt
python manage.py migrate
- name: Run Tests
run: |
Expand Down
26 changes: 17 additions & 9 deletions pulseapi/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,17 +240,25 @@ def show_toolbar(request):
# Database
# https://docs.djangoproject.com/en/1.10/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}

# Try to get DATABASE_URL from the environment (e.g. .env file or CI env vars)
DATABASE_URL = env('DATABASE_URL')

if DATABASE_URL is not None:
DATABASES['default'].update(dj_database_url.config())
if DATABASE_URL:
# If DATABASE_URL is provided, use it to configure the default database
# This will typically be a Postgres database in production or CI
DATABASES = {
'default': dj_database_url.parse(DATABASE_URL)
}
else:
# If DATABASE_URL is not set, fall back to using SQLite
# This is a good default for local development environments
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}



# Password validation
Expand Down
1 change: 1 addition & 0 deletions requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ Pillow==8.3.2
protobuf==3.12.2
psycopg2-binary
requests
setuptools==65.5.1
whitenoise
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#
# This file is autogenerated by pip-compile with python 3.9
# To update, run:
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile
# pip-compile requirements.in
#
boto3==1.16.26
# via -r requirements.in
Expand Down
2 changes: 1 addition & 1 deletion runtime.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
python-3.7.8
python-3.11.8
Loading