Skip to content
Open
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
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
venv
.idea
venv
__pycache__
db.sqlite3
9 changes: 6 additions & 3 deletions CryptoCurrencyRestAPI/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'nydy(tk6kg8lq+y9vf!@$qvmwlb*21tlp5)2pwf5kc1dyn1zbd'
SECRET_KEY = '5=0gcw=t^vjrr%i1$!ffv0i=cn)r&!oza%x+@yb39z9gnr&js@'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
Expand Down Expand Up @@ -75,8 +75,11 @@

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'postgres',
'USER': 'postgres',
'HOST': 'db',
'PORT': 5432,
}
}

Expand Down
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM python:3
ENV PYTHONUNBUFFERED 1
RUN mkdir /code
WORKDIR /code
ADD requirements.txt /code/
RUN pip install -r requirements.txt
ADD . /code/
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
# CryptoCurrencyRestAPI

## docker-compose

https://docs.docker.com/compose/django/#connect-the-database

create project

```
docker-compose run web django-admin.py startproject CryptoCurrencyRestAPI .
```

change owner and group

```
sudo chown $USER:$USER -R .
```

run docker-compose

```
docker-compose up
```

and navigate to 127.0.0.1:8000

## deployment

Running on DigitalOcean droplet, adress: http://206.189.12.80/

## How was this Django project deployed?
Expand Down
18 changes: 18 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: '3'

services:
db:
image: postgres:10.3
ports:
- 5432:5432
volumes:
- ./pgdata:/var/lib/postgresql/data/
web:
build: .
command: python3 manage.py runserver 0.0.0.0:8000
volumes:
- .:/code
ports:
- 8000:8000
depends_on:
- db
Empty file modified manage.py
100644 → 100755
Empty file.
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Django==2.0.4
psycopg2