| author | durandn |
| Thu, 18 Aug 2016 15:46:01 +0200 | |
| changeset 140 | b0aae3bc25d2 |
| parent 46 | 86608f92ebed |
| permissions | -rw-r--r-- |
| 25 | 1 |
# How to start? |
2 |
||
3 |
1. Make sure PIP is installed then install Django and others dependencies with |
|
4 |
||
5 |
``` |
|
6 |
pip install -r requirements.txt |
|
7 |
||
8 |
``` |
|
9 |
||
|
44
6730ec4d7e37
fixing js dependencies
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
33
diff
changeset
|
10 |
2. Move to src/iconolab/static/js/iconolab-bundle to install js dependencies. |
| 25 | 11 |
Make sure your have installed nodejs then run the command bellow |
12 |
||
13 |
``` |
|
14 |
npm install |
|
15 |
||
16 |
``` |
|
17 |
3. To recreate the bundle file that lives in dist/ |
|
18 |
||
19 |
``` |
|
|
46
86608f92ebed
fixing tags
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
44
diff
changeset
|
20 |
npm run build |
| 25 | 21 |
|
22 |
``` |
|
23 |
||
24 |
4. To add a new js module, you can add it to the js/components folder and then run |
|
25 |
||
26 |
``` |
|
27 |
npm start |
|
28 |
``` |
|
29 |
||
30 |
## ICONOLAB ## |
|
31 |
||
32 |
### 1. Configuration and setup |
|
33 |
||
34 |
### virtualenv |
|
35 |
||
36 |
- Install pip |
|
37 |
- Create a virtualenv for the project (using virtualenvwrapper is a good idea if possible). Python version is 3.5.1 |
|
38 |
- Run |
|
39 |
||
40 |
pip install -r requirements.txt |
|
41 |
||
42 |
||
43 |
### node.js |
|
44 |
||
45 |
- Make sure nodejs is installed |
|
46 |
- cd into iconolab/src/iconolab/static/iconolab/js and run |
|
47 |
||
48 |
npm install |
|
49 |
||
50 |
- To recreate the bundle file that lives in dist/ |
|
51 |
||
52 |
npm build |
|
53 |
||
54 |
- To add a new js module, you can add it to the js/components folder and then run |
|
55 |
||
56 |
npm start |
|
57 |
||
58 |
### Django project setup |
|
59 |
||
60 |
- Copy iconolab/src/settings/dev.py.tmpl into iconolab/src/settings/dev.py, adapt content to configuration |
|
61 |
- cd into iconolab/src folder and run |
|
62 |
||
63 |
python manage.py migrate |
|
64 |
||
65 |
to create database tables |
|
66 |
||
67 |
- Run |
|
68 |
||
69 |
python manage.py createsuperuser |
|
70 |
||
71 |
to create an admin user |
|
72 |
||
73 |
- Run |
|
74 |
||
75 |
python manage.py loaddata dev_initial_data |
|
76 |
||
77 |
to load the provided data fixture. This fixture will create at least one of each object used in the app. Details on the fixture data below. |
|
78 |
||
79 |
||
80 |
### 2. Development server |
|
81 |
||
82 |
- cd into the iconolab/src folder and run |
|
83 |
||
84 |
python manage.py runserver |
|
85 |
||
86 |
By default, the app is accessible through http://127.0.0.1:8000/home |
|
87 |
||
| 140 | 88 |
### 3. Importing data from CSV |
| 25 | 89 |
|
| 140 | 90 |
Make sure to have the following in the same folder: |
| 25 | 91 |
|
| 140 | 92 |
* All the images to import. The image names must match their respective item inventory number. |
93 |
* A csv file that contains the metadata for the items you will import |
|
94 |
* A json fixture file for initializing the collection in the database. (Optional if you want to import images in an existing collection) |
|
95 |
* A json fixture file for the metacategories that will be linked to the collection. |
|
| 25 | 96 |
|
| 140 | 97 |
The following django manage.py command is used to import collection data and images: |
| 25 | 98 |
|
| 140 | 99 |
python manage.py importimages <:export-csv-path> --encoding <:encoding> --collection-fixture <:collection_fixture_NAME> (OR --collection-id <:collection_id> --metacategories_fixture <:metacategories_fixture_NAME> |
| 25 | 100 |
|
| 140 | 101 |
Notes: |
102 |
* The export csv path will be used to find everything else (images and fixtures files). |
|
103 |
* If the csv file is not encoded in utf-8, you MUST provide --encoding so the csv file can be read |
|
104 |
* You MUST provide either --collection-fixture or --collection-id, else the command doesn't know to which collection the objects will belong to. |
|
105 |
* The command will first parse the csv, then create the objects in the database (Item and ItemMetadata), then move the images to the settings.MEDIA_ROOT+/uploads/ folder after converting them to JPEG, then create the database objects for the images. The command will ignore any csv row that lacks an image or any csv row that already has a database entry for the collection (INV number is used to test if a database entry exists). |
|
106 |