Skip to content

Commit cacb92c

Browse files
committed
S3 storage and RDS configurations added
1 parent 114d733 commit cacb92c

File tree

7 files changed

+71
-1
lines changed

7 files changed

+71
-1
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[![Code Health](https://landscape.io/github/Cloud-CV/EvalAI/master/landscape.svg?style=flat)](https://landscape.io/github/Cloud-CV/EvalAI/master)
77

88

9-
EvalAI is an open source web application that helps researchers, students and data-scientists to connect, collaborate and participate in various AI challenges organized round the globe.
9+
EvalAI is an open source web application that helps researchers, students and data-scientists to create, collaborate and participate in various AI challenges organized round the globe.
1010

1111
## How to setup
1212

docker/dockerfiles/evalai_base

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM ubuntu:14.04
2+
3+
MAINTAINER Deshraj
4+
5+
6+
# basic requirements
7+
8+
sudo apt-get update && \
9+
apt-get install -y build-essential python-dev python-pip \ python-setuptools libxml2-dev libxslt1-dev zlib1g-dev
10+
11+
WORKDIR = /app
12+
13+
COPY ./requirements /app/requirements
14+
15+
# Install app
16+
RUN pip install --no-cache-dir -r requirements/dev.txt
17+
RUN pip install --no-cache-dir -r requirements/prod.txt
18+
RUN pip install --no-cache-dir -r requirements/docker.txt
19+
RUN pip install --no-cache-dir -r requirements/test.txt

requirements/prod.txt

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-r base.txt
2+
3+
boto==2.43.0
4+
django-storages==1.5.1

requirements/test.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-r base.txt

settings/custom_storages.py

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from django.conf import settings
2+
from storages.backends.s3boto import S3BotoStorage
3+
4+
# In order to make sure that both static and media files are stored in different directories
5+
6+
class StaticStorage(S3BotoStorage):
7+
location = settings.STATICFILES_LOCATION
8+
9+
class MediaStorage(S3BotoStorage):
10+
location = settings.MEDIAFILES_LOCATION

settings/prod.py

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Database
2+
# https://docs.djangoproject.com/en/1.10.2/ref/settings/#databases
3+
4+
DEBUG = False
5+
6+
DATABASES = {
7+
'default': {
8+
'ENGINE': 'django.db.backends.postgresql_psycopg2',
9+
'NAME': os.environ.get('RDS_NAME', ''),
10+
'USER' : os.environ.get('RDS_USER', ''),
11+
'PASSWORD' : os.environ.get('RDS_PASSWORD', ''),
12+
'HOST' : os.environ.get('RDS_HOST', ''),
13+
'PORT' : '5432',
14+
}
15+
}
16+
17+
INSTALLED_APPS += ('storages',)
18+
19+
AWS_ACCESS_KEY_ID = os.environ.get('AWS_ACCESS_KEY_ID', '')
20+
AWS_SECRET_ACCESS_KEY = os.environ.get('AWS_SECRET_ACCESS_KEY', '')
21+
22+
# Amazon S3 Configurations
23+
AWS_STORAGE_BUCKET_NAME = "evalai-static"
24+
25+
STATICFILES_STORAGE = 'custom_storages.StaticStorage'
26+
STATICFILES_LOCATION = 'static'
27+
STATIC_URL = "https://%s/%s/" % (AWS_S3_CUSTOM_DOMAIN, STATICFILES_LOCATION)
28+
29+
MEDIAFILES_LOCATION = 'media'
30+
MEDIA_URL = "https://%s/%s/" % (AWS_S3_CUSTOM_DOMAIN, MEDIAFILES_LOCATION)
31+
DEFAULT_FILE_STORAGE = 'custom_storages.MediaStorage'

static/.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Ignore everything in this directory
2+
*
3+
# Except this file
4+
!.gitignore
5+
!.htaccess

0 commit comments

Comments
 (0)