diff --git a/Dockerfile b/Dockerfile index 3247c74a..e59ec462 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,24 @@ # The first instruction is what image we want to base our container on # We Use an official Python runtime as a parent image FROM python:3.9 # The enviroment variable ensures that the python output is set straight # to the terminal with out buffering it first ENV PYTHONUNBUFFERED 1 +USER 1001 + -# create root directory for our project in the container -RUN mkdir /oacct_checker # Set the working directory to /OACCT_checker WORKDIR /oacct_checker # Copy the current directory contents into the container at /OACCT_checker + ADD . /oacct_checker/ # Install any needed packages specified in requirements.txt RUN pip install -r requirements.txt +COPY . /oacct_checker/ + +CMD [ "python", "./manage.py --settings=settings_dev runserver 0.0.0.0:8000" ] \ No newline at end of file diff --git a/django_api/__pycache__/admin.cpython-39.pyc b/django_api/__pycache__/admin.cpython-39.pyc index 3c5165a8..28795d75 100644 Binary files a/django_api/__pycache__/admin.cpython-39.pyc and b/django_api/__pycache__/admin.cpython-39.pyc differ diff --git a/django_api/__pycache__/models.cpython-39.pyc b/django_api/__pycache__/models.cpython-39.pyc index 962f9146..2781860d 100644 Binary files a/django_api/__pycache__/models.cpython-39.pyc and b/django_api/__pycache__/models.cpython-39.pyc differ diff --git a/django_app/__pycache__/settings.cpython-39.pyc b/django_app/__pycache__/settings.cpython-39.pyc index d2f17b7a..66437e69 100644 Binary files a/django_app/__pycache__/settings.cpython-39.pyc and b/django_app/__pycache__/settings.cpython-39.pyc differ diff --git a/django_app/settings_dev.py b/django_app/settings_dev.py new file mode 100644 index 00000000..d661ed47 --- /dev/null +++ b/django_app/settings_dev.py @@ -0,0 +1,43 @@ +# settings for dev.py + +import environ + +# If using in your own project, update the project namespace below +from django_app.settings import * + +env = environ.Env( + # set casting, default value + DEBUG=(bool, False) +) +# False if not in os.environ +DEBUG = env('DEBUG') + +# Raises django's ImproperlyConfigured exception if SECRET_KEY not in os.environ +SECRET_KEY = env('SECRET_KEY') + +ALLOWED_HOSTS = env.list('ALLOWED_HOSTS') + +# Parse database connection url strings like psql://user:pass@127.0.0.1:8458/db +DATABASES = { + # read os.environ['DATABASE_URL'] and raises ImproperlyConfigured exception if not found + 'default': env.db(), + { + 'ENGINE': 'sqlserver_ado', + 'DBNAME': 'mysql', + 'DBUSER': 'mysql', + 'DBPASSWORD': 'mysql', + 'DBHOST': 'db', + 'PORT': 5432, + } +} + +# MSSQL +# DATABASES = { +# 'default': { +# 'NAME': 'my_database', +# 'ENGINE': 'sqlserver_ado', +# 'HOST': 'dbserver\\ss2012', +# 'USER': '', +# 'PASSWORD': '', +# } +# } \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index ecda7d2e..ef16cb8d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,18 +1,21 @@ version: "3.9" services: db: - image: postgres + image: mysql environment: - - POSTGRES_DB=postgres - - POSTGRES_USER=postgres - - POSTGRES_PASSWORD=postgres + - DBHOST=mysql + - DBNAME=mysql + - DBUSER=mysql + - DBPASSWORD=mysql web: build: . command: python manage.py runserver 0.0.0.0:8000 volumes: - .:/oacct_checker ports: - "8000:8000" depends_on: - - db \ No newline at end of file + - db + + diff --git a/requirements.txt b/requirements.txt index 48d6dd28..31381f2e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,20 +1,22 @@ asgiref==3.3.1 certifi==2020.12.5 chardet==4.0.0 coreschema==0.0.4 -Django==3.1.4 +Django>=3.0,<4.0 django-coreapi==2.3.0 django-cors-headers==3.6.0 djangorestframework==3.12.2 idna==2.10 itypes==1.2.0 Jinja2==2.11.2 MarkupSafe==1.1.1 pytz==2020.4 requests==2.25.1 sqlparse==0.4.1 uritemplate==3.0.1 urllib3==1.26.2 Pillow==8.0.1 django-import-export - +psycopg2-binary>=2.8 +environ +django-mssql \ No newline at end of file