Hello Everyone,
If you happened to install Arches v4.0b3 and created a project using the
"arches-project create" command and want to keep that project then the
following instructions are for you!
The first thing to do is download the attached python script file
(update_project.py).
The script file takes the path of the project root as the only positional
argument. Example:
*python update_project.py
~/Documents/projects/GCI/arches_v4/myproject/myproject*
Running this script will do the following:
1. Add an empty arches.log file in root.
2. Create a directory called logs in root if it doesn't exist and add an
empty file called 'resource_import.log'.
3. Create a file in root called 'proposed_settings.py' which is a copy
of the project's original settings.py file plus the new v4 settings.
4. Download the bower.json file to root and name it 'proposed_bower.json'
Once you run this file you just need to:
1. Review 'proposed_settings.py' and either rename it 'settings.py' or
copy its contents to 'settings.py'.
2. Rename 'proposed_bower.json' to 'bower.json' or copy its contents to
'bower.json'.
Finally, *MAKE A BACKUP OF YOUR DATABASE**,* then cd into the root of the
project and then run the following commands from an activated virtual
environment:
1. pip install arches --upgrade
2. python manage.py migrate
3. bower install (from the directory where the bower.json file exists)
4. bower prune
Go into your /templates directory and remove the following files, unless
you've modified them, in which case you'll need to get new copies of those
files from here (
https://github.com/archesproject/arches/tree/4.0.0/arches/app/templates)
and apply your modifications to those new files:
1. base-manager.htm
2. login.htm
Now start Arches.
1. open a browser (Google chrome)
2. login to Arches as 'admin'
3. navigate to /settings
4. update your Mapbox API Key (Go to Map Settings –> Mapbox API) (the
old location for the key is in settings.py)
For further settings help go here:
http://arches4.readthedocs.io/en/latest/initial-configuration/
That's it! Arches v4 should be running properly!
If you have any further questions please post them to the forum and we'll
try to answer them as soon as we can.
Cheers,
The Arches Team
--
-- To post, send email to [email protected]. To unsubscribe, send
email to [email protected]. For more information,
visit https://groups.google.com/d/forum/archesproject?hl=en
---
You received this message because you are subscribed to the Google Groups
"Arches Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
import argparse
import os
import string
import textwrap
import urllib
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument("target", help="The project to be updated. This should the full path to the project root (where bower.json is located). For example 'Documents/projects/myproject/myproject'")
return parser.parse_args()
def add_log_files(project_path):
if os.path.exists(os.path.join(project_path, 'logs')) == False:
os.mkdir(os.path.join(project_path, 'logs'))
print 'created directory', os.path.join(project_path, 'logs')
if os.path.exists(os.path.join(project_path, 'logs', 'resource_import.log')) == False:
open(os.path.join(project_path, 'logs', 'resource_import.log'), 'w').close()
print 'added file', os.path.join(project_path, 'logs', 'resource_import.log')
else:
print os.path.join(project_path, 'logs', 'resource_import.log'), 'already exists'
if os.path.exists(os.path.join(project_path, 'arches.log')) == False:
open(os.path.join(project_path,'arches.log'), 'w').close()
print 'added file', os.path.join(project_path,'arches.log')
else:
print os.path.join(project_path, 'arches.log'), 'already exists'
def add_proposed_settings(project_path):
template_context = {'project_name': os.path.split(project_path)[1]}
new_settings = string.Template('''
TEMPLATES[0]['DIRS'].append(os.path.join(APP_ROOT, 'widgets', 'templates'))
DATATYPE_LOCATIONS.append('$project_name.datatypes')
RESOURCE_IMPORT_LOG = os.path.join(APP_ROOT, 'logs', 'resource_import.log')
LOGGING = { 'disable_existing_loggers': False,
'handlers': { 'file': { 'class': 'logging.FileHandler',
'filename': os.path.join(APP_ROOT, 'arches.log'),
'level': 'DEBUG'}},
'loggers': { 'arches': { 'handlers': [ 'file'],
'level': 'DEBUG',
'propagate': True}},
'version': 1}
TILE_CACHE_CONFIG = {
"name": "Disk",
"path": os.path.join(APP_ROOT, 'tileserver', 'cache')
# to reconfigure to use S3 (recommended for production), use the following
# template:
# "name": "S3",
# "bucket": "<bucket name>",
# "access": "<access key>",
# "secret": "<secret key>"
}
''').substitute(template_context)
existing_settings = None
with open(os.path.join(project_path, 'settings.py'), 'r') as f:
existing_settings = f.readlines()
if os.path.exists(os.path.join(project_path, 'settings_proposed.py')) == False:
with open(os.path.join(project_path,'settings_proposed.py'), 'w') as f:
for setting in existing_settings:
f.write(setting)
if setting.startswith('DEBUG'):
f.write(textwrap.dedent(new_settings))
print 'settings_proposed.py file written to', project_path
else:
print 'settings_proposed already exists'
def add_proposed_json(project_path):
testfile = urllib.URLopener()
if os.path.exists(os.path.join(project_path, 'proposed_bower.js')) == False:
testfile.retrieve("https://raw.githubusercontent.com/archesproject/arches/4.0.0/bower.json", os.path.join(project_path, 'proposed_bower.json'))
print 'downloaded', os.path.join(project_path, 'proposed_bower.json')
else:
print os.path.join(project_path, 'proposed_bower.json'), 'already exists'
def main():
args = get_args()
project_path = args.target
if os.path.exists(project_path) == True:
add_log_files(project_path)
add_proposed_settings(project_path)
add_proposed_json(project_path)
else:
print 'project path is not valid'
main()