-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from CarliJoy/improve_testing
Improve testing
- Loading branch information
Showing
17 changed files
with
517 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
POSTGRES_HOST=postgres | ||
POSTGRES_PASSWORD=django_pint | ||
POSTGRES_USER=django_pint | ||
POSTGRES_DB=django_pint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
FROM python:3.8-slim | ||
|
||
# install system dependencies | ||
|
||
RUN apt-get update | ||
|
||
RUN apt-get install -y build-essential libpq-dev curl gettext git postgresql-client | ||
|
||
RUN pip3 install --upgrade wheel setuptools pip | ||
|
||
RUN pip3 install pre-commit psycopg2-binary ipdb | ||
|
||
WORKDIR /django-pint | ||
|
||
# copy application files | ||
COPY . /django-pint | ||
|
||
RUN pre-commit install | ||
|
||
RUN pip install -e '.[testing]' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
psql -c "create database django_pint;" -U postgres | ||
# Settings done according to tutorial https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-18-04 | ||
# Please not you might have to edit your pg_hba.conf in your local installation | ||
# see https://docs.boundlessgeo.com/suite/1.1.1/dataadmin/pgGettingStarted/firstconnect.html#allowing-local-connections | ||
psql -c "CREATE USER django_pint WITH PASSWORD 'not_secure_in_testing';" -U postgres | ||
psql -c "ALTER ROLE django_pint SET client_encoding TO 'utf8';" -U postgres | ||
psql -c "ALTER ROLE django_pint SET timezone TO 'UTC';" -U postgres | ||
psql -c "GRANT ALL PRIVILEGES ON DATABASE django_pint TO django_pint;" -U postgres | ||
psql -c "ALTER ROLE django_pint CREATEDB;" -U postgres |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
version: '3' | ||
|
||
volumes: | ||
postgres_data: {} | ||
|
||
services: | ||
|
||
postgres: | ||
image: postgres:12-alpine | ||
volumes: | ||
- postgres_data:/var/lib/postgresql/data # DB persistance | ||
env_file: | ||
- .env | ||
ports: | ||
- "5432:5432" | ||
|
||
app: &app | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
image: django-pint | ||
depends_on: | ||
- postgres | ||
volumes: | ||
- .:/django-pint | ||
ports: | ||
- "8000:8000" | ||
env_file: | ||
- .env | ||
command: sleep 5d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env python | ||
"""Django's command-line utility for administrative tasks.""" | ||
import os | ||
import sys | ||
|
||
|
||
def main(): | ||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "RoWoOekostromDB.settings") | ||
try: | ||
from django.core.management import execute_from_command_line | ||
except ImportError as exc: | ||
raise ImportError( | ||
"Couldn't import Django. Are you sure it's installed and " | ||
"available on your PYTHONPATH environment variable? Did you " | ||
"forget to activate a virtual environment?" | ||
) from exc | ||
execute_from_command_line(sys.argv) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import os | ||
|
||
PG_HOST = os.environ.get('POSTGRES_HOST') | ||
PG_DATABASE = os.environ.get('POSTGRES_DB') | ||
PG_USER = os.environ.get('POSTGRES_USER') | ||
PG_PASSWORD = os.environ.get('POSTGRES_PASSWORD') |
Oops, something went wrong.