Skip to content

Commit 9a855c6

Browse files
Development Fixes (pavement, settings, and migrations) (GeoNode#2617)
* Fixed migrations, settings.py, and pavement for development * pavement: moved migrate_apps to yaml
2 parents 579d2a9 + 528c8a2 commit 9a855c6

File tree

6 files changed

+125
-17
lines changed

6 files changed

+125
-17
lines changed

dev_config.yml

+8
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,11 @@ WINDOWS:
77
nose: "https://s3.amazonaws.com/geonodedeps/nose-1.3.3.win32-py2.7.exe"
88
pyproj: "https://pyproj.googlecode.com/files/pyproj-1.9.3.win32-py2.7.exe"
99
lxml: "https://pypi.python.org/packages/2.7/l/lxml/lxml-3.6.0.win32-py2.7.exe"
10+
MIGRATE_APPS:
11+
- account
12+
- contenttypes
13+
- sites
14+
- auth
15+
- people
16+
- base
17+
- services
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# -*- coding: utf-8 -*-
2+
# flake8: noqa
3+
from __future__ import unicode_literals
4+
5+
from django.db import migrations, models
6+
7+
8+
class Migration(migrations.Migration):
9+
10+
dependencies = [
11+
('base', '0003_auto_20160821_1919'),
12+
]
13+
14+
operations = [
15+
migrations.AlterField(
16+
model_name='contactrole',
17+
name='role',
18+
field=models.CharField(
19+
help_text='function performed by the responsible party',
20+
max_length=255,
21+
choices=[
22+
(b'author', 'party who authored the resource'),
23+
(b'processor', 'party who has processed the data in a manner such that the resource has been modified'),
24+
(b'publisher', 'party who published the resource'),
25+
(b'custodian', 'party that accepts accountability and responsibility for the data and ensures appropriate care and maintenance of the resource'),
26+
(b'pointOfContact', 'party who can be contacted for acquiring knowledge about or acquisition of the resource'),
27+
(b'distributor', 'party who distributes the resource'),
28+
(b'user', 'party who uses the resource'),
29+
(b'resourceProvider', 'party that supplies the resource'),
30+
(b'originator', 'party who created the resource'),
31+
(b'owner', 'party that owns the resource'),
32+
(b'principalInvestigator', 'key party responsible for gathering information and conducting research')]),
33+
),
34+
migrations.AlterField(
35+
model_name='resourcebase',
36+
name='category',
37+
field=models.ForeignKey(
38+
blank=True,
39+
to='base.TopicCategory',
40+
help_text='high-level geographic data thematic classification to assist in the grouping and search of available geographic data sets.',
41+
null=True),
42+
),
43+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# -*- coding: utf-8 -*-
2+
# flake8: noqa
3+
from __future__ import unicode_literals
4+
5+
from django.db import migrations, models
6+
import taggit.managers
7+
8+
9+
class Migration(migrations.Migration):
10+
11+
dependencies = [
12+
('people', '0002_auto_20160821_1919'),
13+
]
14+
15+
operations = [
16+
migrations.AlterField(
17+
model_name='profile',
18+
name='keywords',
19+
field= taggit.managers.TaggableManager(
20+
to='taggit.Tag',
21+
through='taggit.TaggedItem',
22+
blank=True,
23+
help_text='commonly used word(s) or formalised word(s) or phrase(s) used to describe the subject (space or comma-separated',
24+
verbose_name='keywords'),
25+
),
26+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# -*- coding: utf-8 -*-
2+
# flake8: noqa
3+
from __future__ import unicode_literals
4+
5+
from django.db import migrations, models
6+
7+
8+
class Migration(migrations.Migration):
9+
10+
dependencies = [
11+
('services', '0002_auto_20160821_1919'),
12+
]
13+
14+
operations = [
15+
migrations.AlterField(
16+
model_name='serviceprofilerole',
17+
name='role',
18+
field=models.CharField(
19+
help_text='function performed by the responsible party',
20+
max_length=255,
21+
choices=[
22+
(b'author', 'party who authored the resource'),
23+
(b'processor', 'party who has processed the data in a manner such that the resource has been modified'),
24+
(b'publisher', 'party who published the resource'),
25+
(b'custodian', 'party that accepts accountability and responsibility for the data and ensures appropriate care and maintenance of the resource'),
26+
(b'pointOfContact', 'party who can be contacted for acquiring knowledge about or acquisition of the resource'),
27+
(b'distributor', 'party who distributes the resource'),
28+
(b'user', 'party who uses the resource'),
29+
(b'resourceProvider', 'party that supplies the resource'),
30+
(b'originator', 'party who created the resource'),
31+
(b'owner', 'party that owns the resource'),
32+
(b'principalInvestigator', 'key party responsible for gathering information and conducting research')]),
33+
),
34+
]

geonode/settings.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,14 @@
6161
_DEFAULT_SECRET_KEY = 'myv-y4#7j-d*p-__@j#*3z@!y24fz8%^z2v6atuy4bo9vqr1_a'
6262
SECRET_KEY = os.getenv('SECRET_KEY', _DEFAULT_SECRET_KEY)
6363

64-
DATABASE_URL = os.getenv('DATABASE_URL', 'sqlite:///development.db')
64+
DATABASE_URL = os.getenv(
65+
'DATABASE_URL',
66+
'sqlite:///{path}'.format(path=os.path.join(PROJECT_ROOT, 'development.db')))
6567

6668
# Defines settings for development
67-
DATABASES = {'default':
68-
dj_database_url.parse(DATABASE_URL, conn_max_age=600),
69-
}
69+
DATABASES = {
70+
'default': dj_database_url.parse(DATABASE_URL, conn_max_age=600)
71+
}
7072

7173
MANAGERS = ADMINS = os.getenv('ADMINS', [])
7274

@@ -926,7 +928,7 @@
926928
pass
927929

928930

929-
# Load additonal basemaps, see geonode/contrib/api_basemap/README.md
931+
# Load additonal basemaps, see geonode/contrib/api_basemap/README.md
930932
try:
931933
from geonode.contrib.api_basemaps import *
932934
except ImportError:

pavement.py

+7-12
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
with open("dev_config.yml", 'r') as f:
5656
dev_config = yaml.load(f)
5757

58+
5859
def grab(src, dest, name):
5960
download = True
6061
if not dest.exists():
@@ -74,6 +75,7 @@ def grab(src, dest, name):
7475
else:
7576
urllib.urlretrieve(str(src), str(dest))
7677

78+
7779
@task
7880
@cmdopts([
7981
('geoserver=', 'g', 'The location of the geoserver build (.war file).'),
@@ -212,18 +214,11 @@ def sync(options):
212214
"""
213215
Run the syncdb and migrate management commands to create and migrate a DB
214216
"""
215-
try:
216-
sh("python manage.py migrate auth --noinput")
217-
except:
218-
pass
219-
try:
220-
sh("python manage.py migrate sites --noinput")
221-
except:
222-
pass
223-
try:
224-
sh("python manage.py migrate people --noinput")
225-
except:
226-
pass
217+
for app in dev_config['MIGRATE_APPS']:
218+
try:
219+
sh("python manage.py migrate {app} --noinput".format(app=app))
220+
except:
221+
pass
227222
try:
228223
sh("python manage.py migrate --noinput")
229224
except:

0 commit comments

Comments
 (0)