Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
# Conflicts:
#	Pipfile.lock
#	db.sqlite3
  • Loading branch information
moeiniamir committed May 2, 2020
2 parents a548540 + 7d6fa2d commit 8ffd6f0
Show file tree
Hide file tree
Showing 66 changed files with 369 additions and 48 deletions.
26 changes: 9 additions & 17 deletions Dockerfile.prod
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,26 @@ FROM python:3.7.4-alpine
# set work directory
WORKDIR /usr/src/app


RUN apk add --no-cache --virtual .build-deps gcc musl-dev

# install python-dev
RUN apk update \
&& apk add --virtual .build-deps gcc libc-dev libxslt-dev \
&& apk add --no-cache libxslt

# install psycopg2
# install psycopg2 dependencies
RUN apk update \
&& apk add --virtual build-deps gcc python3-dev musl-dev \
&& apk add postgresql-dev \
&& pip install psycopg2 \
&& apk del build-deps

# install zlib for pillow
# RUN apk add --no-cache jpeg-dev zlib-dev
&& apk add postgresql-dev

# install dependencies
RUN pip install --upgrade pipenv
RUN pip install --upgrade pip pipenv

COPY ./Pipfile /usr/src/app/Pipfile
COPY ./Pipfile.lock /usr/src/app/Pipfile.lock

# copy entrypoint-prod.sh
COPY ./entrypoint.prod.sh /usr/src/app/entrypoint.prod.sh

RUN pipenv install

# copy project
COPY . /usr/src/app/
RUN pipenv install


#psycopg2 django-heroku django-import-export
# run entrypoint.prod.sh
ENTRYPOINT ["/usr/src/app/entrypoint.prod.sh"]
3 changes: 3 additions & 0 deletions Pipfile
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ verify_ssl = true

[packages]
django = "==3.0.5"
gunicorn = "==20.0.4"
django-import-export = "==2.0.2"
django-heroku = "==0.3.1"

[requires]
python_version = "3.8"
174 changes: 171 additions & 3 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file modified README.md
100644 → 100755
Empty file.
Binary file modified db.sqlite3
100644 → 100755
Binary file not shown.
4 changes: 2 additions & 2 deletions entrypoint.prod.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ then
echo "PostgreSQL started"
fi

python manage.py migrate
python manage.py collectstatic --no-input --clear
pipenv run python manage.py migrate
pipenv run python manage.py collectstatic --no-input --clear

exec "$@"
2 changes: 1 addition & 1 deletion manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'rasta_problem_bank.settings')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'rasta_problem_bank.settings.development')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
Expand Down
Empty file modified mhbank/__init__.py
100644 → 100755
Empty file.
Empty file modified mhbank/__pycache__/__init__.cpython-37.pyc
100644 → 100755
Empty file.
Empty file modified mhbank/__pycache__/admin.cpython-37.pyc
100644 → 100755
Empty file.
Empty file modified mhbank/__pycache__/apps.cpython-37.pyc
100644 → 100755
Empty file.
Empty file modified mhbank/__pycache__/forms.cpython-37.pyc
100644 → 100755
Empty file.
Empty file modified mhbank/__pycache__/models.cpython-37.pyc
100644 → 100755
Empty file.
Empty file modified mhbank/__pycache__/urls.cpython-37.pyc
100644 → 100755
Empty file.
Empty file modified mhbank/__pycache__/views.cpython-37.pyc
100644 → 100755
Empty file.
Empty file modified mhbank/__pycache__/widgets.cpython-37.pyc
100644 → 100755
Empty file.
Empty file modified mhbank/admin.py
100644 → 100755
Empty file.
Empty file modified mhbank/apps.py
100644 → 100755
Empty file.
Empty file modified mhbank/forms.py
100644 → 100755
Empty file.
Empty file modified mhbank/hashem.py
100644 → 100755
Empty file.
Empty file modified mhbank/migrations/0001_initial.py
100644 → 100755
Empty file.
Empty file modified mhbank/migrations/0002_auto_20200422_2131.py
100644 → 100755
Empty file.
Empty file modified mhbank/migrations/0003_auto_20200422_2335.py
100644 → 100755
Empty file.
Empty file modified mhbank/migrations/0004_auto_20200422_2356.py
100644 → 100755
Empty file.
Empty file modified mhbank/migrations/0005_auto_20200423_0041.py
100644 → 100755
Empty file.
Empty file modified mhbank/migrations/0006_auto_20200423_0101.py
100644 → 100755
Empty file.
Empty file modified mhbank/migrations/0007_auto_20200423_0102.py
100644 → 100755
Empty file.
Empty file modified mhbank/migrations/0008_auto_20200423_0106.py
100644 → 100755
Empty file.
Empty file modified mhbank/migrations/0009_auto_20200423_1558.py
100644 → 100755
Empty file.
Empty file modified mhbank/migrations/0010_auto_20200423_1640.py
100644 → 100755
Empty file.
Empty file modified mhbank/migrations/0011_auto_20200423_1643.py
100644 → 100755
Empty file.
Empty file modified mhbank/migrations/0012_auto_20200423_1644.py
100644 → 100755
Empty file.
Empty file modified mhbank/migrations/0013_account_last_added_question.py
100644 → 100755
Empty file.
Empty file modified mhbank/migrations/__init__.py
100644 → 100755
Empty file.
Empty file modified mhbank/migrations/__pycache__/0001_initial.cpython-37.pyc
100644 → 100755
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file modified mhbank/migrations/__pycache__/__init__.cpython-37.pyc
100644 → 100755
Empty file.
Empty file modified mhbank/models.py
100644 → 100755
Empty file.
Empty file modified mhbank/tests.py
100644 → 100755
Empty file.
Empty file modified mhbank/urls.py
100644 → 100755
Empty file.
Empty file modified mhbank/views.py
100644 → 100755
Empty file.
Empty file modified mhbank/widgets.py
100644 → 100755
Empty file.
Empty file modified rasta_problem_bank/__init__.py
100644 → 100755
Empty file.
Empty file modified rasta_problem_bank/__pycache__/__init__.cpython-37.pyc
100644 → 100755
Empty file.
Empty file modified rasta_problem_bank/__pycache__/settings.cpython-37.pyc
100644 → 100755
Empty file.
Empty file modified rasta_problem_bank/__pycache__/urls.cpython-37.pyc
100644 → 100755
Empty file.
Empty file modified rasta_problem_bank/__pycache__/wsgi.cpython-37.pyc
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion rasta_problem_bank/asgi.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@

from django.core.asgi import get_asgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'rasta_problem_bank.settings')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'rasta_problem_bank.settings.development')

application = get_asgi_application()
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Django settings for rasta_problem_bank project.
Generated by 'django-admin startproject' using Django 3.0.5.
Generated by 'django-admin startproject' using Django 3.0.4.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/
Expand All @@ -12,32 +12,32 @@

import os

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

def get_environment_var(var_name, default, prefixed=True):
if prefixed:
var_name = 'BANK_SERVER_%s' % var_name
return os.getenv(var_name, default)

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '3vn$cbhyxv5r3c-iu6i9cm8yaqvz0^9kblha1wq4@0jp13hgjv'
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/


# Application definition

INSTALLED_APPS = [
'mhbank.apps.MhbankConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'import_export',
'mhbank',
]

MIDDLEWARE = [
Expand Down Expand Up @@ -71,17 +71,6 @@
WSGI_APPLICATION = 'rasta_problem_bank.wsgi.application'


# Database
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases

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


# Password validation
# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators

Expand All @@ -104,7 +93,7 @@
# Internationalization
# https://docs.djangoproject.com/en/3.0/topics/i18n/

LANGUAGE_CODE = 'fa-ir'
LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'Asia/Tehran'

Expand All @@ -114,12 +103,44 @@

USE_TZ = True



# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.0/howto/static-files/

STATIC_URL = '/static/'

MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')


EMAIL_HOST = 'smtp.zoho.com'
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = 'ET6vmrh.$gHZFjL'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_USE_SSL = False
DEFAULT_FROM_EMAIL = "Rastaiha <" + EMAIL_HOST_USER + ">"

# Activate Django-Heroku.

OK_STATUS = 'ok'
ERROR_STATUS = 'err'
HELP_STATUS = 'help'

DJANGO_NOTIFICATIONS_CONFIG = {
'USE_JSONFIELD': True,
'SOFT_DELETE': True,
'NUM_TO_FETCH': 40,
}


THUMBNAIL_ALIASES = {
'': {
'avatar': {'size': (80, 80), 'crop': True},
},
}


STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage'

Loading

0 comments on commit 8ffd6f0

Please sign in to comment.