File tree Expand file tree Collapse file tree 2 files changed +8
-15
lines changed Expand file tree Collapse file tree 2 files changed +8
-15
lines changed Original file line number Diff line number Diff line change @@ -2,3 +2,4 @@ Django==1.9.2
2
2
graphene[django]==0.7.3
3
3
django-graphiql==0.4.4
4
4
django-filter==0.12.0
5
+ django-environ==0.4.0
Original file line number Diff line number Diff line change 138
138
# Change the database setup if we have DB environment
139
139
# vars. Useful for Heroku/Dokku databases
140
140
141
- DB_NAME = os .environ .get ('DB_NAME ' )
142
- DB_HOST = os . environ . get ( 'DB_HOST' )
143
- DB_USER = os . environ . get ( 'DB_USER' )
144
- DB_PASSWORD = os . environ . get ( 'DB_PASS' )
145
- DB_PORT = os . environ .get ( 'DB_PORT' )
141
+ DATABASE_URL = os .environ .get ('DATABASE_URL ' )
142
+
143
+ if DATABASE_URL :
144
+ import environ
145
+ env = environ .Env ( )
146
146
147
- if DB_NAME and DB_HOST and DB_USER :
148
147
DATABASES = {
149
- 'default' : {
150
- 'ENGINE' : 'django.db.backends.mysql' ,
151
- 'NAME' : DB_NAME ,
152
- 'HOST' : DB_HOST ,
153
- 'USER' : DB_USER ,
154
- 'PASSWORD' : DB_PASSWORD ,
155
- 'PORT' : DB_PORT ,
148
+ 'default' : dict ({
156
149
'OPTIONS' : {
157
- 'init_command' : 'SET storage_engine=InnoDB' ,
158
150
'charset' : 'utf8' ,
159
151
'use_unicode' : True ,
160
152
},
161
153
'TEST_CHARSET' : 'utf8' ,
162
154
'TEST_COLLATION' : 'utf8_general_ci' ,
163
- }
155
+ }, ** env . db ())
164
156
}
165
157
166
158
GRAPHENE_SCHEMA = 'starwars.schema'
You can’t perform that action at this time.
0 commit comments