Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 2a536ac

Browse files
authoredMar 30, 2018
Settings: Update django project settings (Cloud-CV#1610)
1 parent 4f09e0d commit 2a536ac

File tree

14 files changed

+37
-197
lines changed

14 files changed

+37
-197
lines changed
 

‎.coveragerc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,4 @@ omit =
2121
*/middleware/*
2222
frontend/
2323
settings/prod.py
24-
settings/staging.py
2524
scripts/seed.py

‎README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ You can also use Docker Compose to run all the components of EvalAI together. Th
6666

6767
### Using Virtual Environment
6868

69-
1. Install [python] 2.x (EvalAI only supports python2.x for now.), [git], [postgresql] version >= 10.1, [RabbitMQ] and [virtualenv], in your computer, if you don't have it already.
69+
1. Install [python] 2.7.10 or above, [git], [postgresql] version >= 10.1, [RabbitMQ] and [virtualenv], in your computer, if you don't have it already.
7070
*If you are having trouble with postgresql on Windows check this link [postgresqlhelp].*
7171
7272
2. Get the source code on your machine via git.
@@ -96,13 +96,13 @@ You can also use Docker Compose to run all the components of EvalAI together. Th
9696
```
9797
sudo -i -u (username)
9898
createdb evalai
99-
python manage.py migrate --settings=settings.dev
99+
python manage.py migrate
100100
```
101101
102102
6. Seed the database with some fake data to work with.
103103
104104
```
105-
python manage.py seed --settings=settings.dev
105+
python manage.py seed
106106
```
107107
This command also creates a `superuser(admin)`, a `host user` and a `participant user` with following credentials.
108108
@@ -113,7 +113,7 @@ You can also use Docker Compose to run all the components of EvalAI together. Th
113113
7. That's it. Now you can run development server at [http://127.0.0.1:8000] (for serving backend)
114114

115115
```
116-
python manage.py runserver --settings=settings.dev
116+
python manage.py runserver
117117
```
118118

119119

‎docker/dev/django/container-start.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/sh
22
cd /code && \
3-
python manage.py migrate --noinput --settings=settings.dev && \
4-
python manage.py seed --settings=settings.dev && \
5-
python manage.py runserver --settings=settings.dev 0.0.0.0:8000
3+
python manage.py migrate --noinput && \
4+
python manage.py seed && \
5+
python manage.py runserver 0.0.0.0:8000

‎docker/prod/django/evalai_supervisor.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[program:uwsgi]
22
directory=/code
3-
environment=DJANGO_SETTINGS_MODULE="settings.prod"
3+
environment=DJANGO_SETTINGS_MODULE="settings"
44
command=/usr/local/bin/uwsgi --ini=docker/prod/django/uwsgi.ini
55
autostart=true
66
autorestart=true

‎docs/source/directory_structure.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,5 +94,5 @@ All of the codebase related to testing resides in `tests` folder in the root dir
9494
To perform certain actions like seeding the database, we use Django management commands. Since the management commands are common throughout the project, they are present in `base` application directory. At the moment, the only management command is `seed`, which is used to populate the database with some random values. The command can be invoked by calling
9595

9696
```
97-
python manage.py seed --settings=settings.dev
97+
python manage.py seed
9898
```

‎docs/source/migrations.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ python manage.py makemigrations jobs --name=execution_time_limit
2424
* While creating migrations on local environment, don't forget to add development settings.
2525

2626
```
27-
python manage.py makemigrations --settings=settings.dev
27+
python manage.py makemigrations
2828
```
2929

3030
The following is an example of a complete named migration for the `jobs` app, wherein a execution time limit field is added to the `Submission` model:
3131

3232
```
33-
python manage.py makemigrations jobs --name=execution_time_limit --settings=settings.dev
33+
python manage.py makemigrations jobs --name=execution_time_limit
3434
```
3535

3636
* Files create after running `makemigrations` should be committed along with other files

‎docs/source/setup.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ createdb evalai -U postgres
9393
# update postgres user password
9494
psql -U postgres -c "ALTER USER postgres PASSWORD 'postgres';"
9595
# run migrations
96-
python manage.py migrate --settings=settings.dev
96+
python manage.py migrate
9797
```
9898
9999
* For setting up frontend, run
@@ -110,7 +110,7 @@ bower install
110110
```
111111
# activate virtual environment if not activated
112112
source venv/bin/activate
113-
python manage.py runserver --settings=settings.dev
113+
python manage.py runserver
114114
```
115115

116116
* To run frontend development server at [http://127.0.0.1:8888](http://127.0.0.1:8888), simply do:
@@ -205,7 +205,7 @@ createdb evalai -U postgres
205205
# update postgres user password
206206
psql -U postgres -c "ALTER USER postgres PASSWORD 'postgres';"
207207
# run migrations
208-
python manage.py migrate --settings=settings.dev
208+
python manage.py migrate
209209
```
210210

211211
* For setting up frontend, run
@@ -223,7 +223,7 @@ npm install -g bower
223223
```
224224
# activate virtual environment if not activated
225225
source venv/bin/activate
226-
python manage.py runserver --settings=settings.dev
226+
python manage.py runserver
227227
```
228228

229229
* To run frontend development server for at [frontend]
@@ -236,7 +236,7 @@ gulp dev:runserver
236236
```
237237
# activate virtual environment if not activated
238238
source venv/bin/activate
239-
python manage.py runserver --settings=settings.dev
239+
python manage.py runserver
240240
```
241241

242242
* To run frontend development server at [http://127.0.0.1:8888](http://127.0.0.1:8888), simply do:
@@ -302,13 +302,13 @@ Follow this guide to setup your development machine.
302302
```
303303
Enter your password for authentication and a new database will be added.
304304
```
305-
python manage.py migrate --settings=settings.dev
305+
python manage.py migrate
306306
```
307307

308308
* Seed the database with some fake data to work with.
309309

310310
```
311-
python manage.py seed --settings=settings.dev
311+
python manage.py seed
312312
```
313313
This command also creates a `superuser(admin)`, a `host user` and a `participant user` with following credentials.
314314

@@ -321,7 +321,7 @@ Follow this guide to setup your development machine.
321321
* That's it. Now you can run development server at [http://127.0.0.1:8000] (for serving backend)
322322
323323
```
324-
python manage.py runserver --settings=settings.dev
324+
python manage.py runserver
325325
```
326326
327327

‎docs/source/windows_installation.md

Lines changed: 0 additions & 85 deletions
This file was deleted.

‎evalai/wsgi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111

1212
from django.core.wsgi import get_wsgi_application
1313

14-
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings.prod")
14+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
1515

1616
application = get_wsgi_application()

‎manage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import sys
44

55
if __name__ == "__main__":
6-
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings.prod")
6+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
77
try:
88
from django.core.management import execute_from_command_line
99
except ImportError:

‎scripts/seed.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Command to run : python manage.py shell --settings=settings.dev < scripts/seed.py
1+
# Command to run : python manage.py shell < scripts/seed.py
22
import os
33

44
from datetime import timedelta

‎settings/__init__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# -*- coding: utf-8 -*-
2+
from __future__ import absolute_import
3+
4+
try:
5+
from .dev import * # noqa
6+
except ImportError:
7+
pass
8+
9+
try:
10+
from .prod import * # noqa
11+
except ImportError:
12+
pass

‎settings/prod.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55

66
DEBUG = False
77

8-
ALLOWED_HOSTS = ['evalapi.cloudcv.org', 'evalai.cloudcv.org']
8+
ALLOWED_HOSTS = ['evalapi.cloudcv.org', 'evalai.cloudcv.org',
9+
'api.evalai.cloudcv.org', 'staging.evalai.cloudcv.org']
910

1011
# Database
1112
# https://docs.djangoproject.com/en/1.10.2/ref/settings/#databases
@@ -15,6 +16,7 @@
1516
CORS_ORIGIN_WHITELIST = (
1617
'evalai.cloudcv.org',
1718
'evalai.s3.amazonaws.com',
19+
'staging.evalai.cloudcv.org',
1820
)
1921

2022
DATABASES = {

‎settings/staging.py

Lines changed: 0 additions & 88 deletions
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.