Skip to content

Commit 32a38ce

Browse files
authored
Merge pull request #26 from peopledoc/demo-migrations-db
Added documentation to install and bootstrap the demo app
2 parents 2036353 + 2e85c58 commit 32a38ce

File tree

7 files changed

+7927
-2
lines changed

7 files changed

+7927
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
# master (unreleased)
44

5-
- Changing Github Organization from ``novafloss`` to ``peopledoc`` (#24)
5+
- Changing Github Organization from ``novafloss`` to ``peopledoc`` (#24),
6+
- Added documentation to install and bootstrap the demo app.
67

78
## 1.3.0 (2017-09-14)
89

demo/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
demo_chunkator.db

demo/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Django Chunkator demo app
2+
3+
this demo app is mainly used for running tests, but you may want to install it for manual testing
4+
5+
## Install
6+
7+
* (create and) activate a virtualenv (using your favorite Python version)
8+
* from this virtualenv, install your required Django version. e.g.: ``pip install Django==1.11``
9+
* from this directory, install the demo app: ``pip install -e ./``
10+
11+
12+
### Set up the database
13+
14+
This will create the SQLite database and sync its models:
15+
16+
```sh
17+
django-admin migrate --settings=demo_chunkator.settings
18+
```
19+
20+
### Feed the "bookstore"
21+
22+
We're providing a sample ``book.json`` fixture, to load into your DB like this:
23+
24+
```sh
25+
django-admin loaddata --settings=demo_chunkator.settings book.json
26+
```
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# -*- coding: utf-8 -*-
2+
# Generated by Django 1.11 on 2018-05-14 04:22
3+
from __future__ import unicode_literals
4+
5+
from django.db import migrations, models
6+
import django.db.models.deletion
7+
import uuid
8+
9+
10+
class Migration(migrations.Migration):
11+
12+
initial = True
13+
14+
dependencies = [
15+
]
16+
17+
operations = [
18+
migrations.CreateModel(
19+
name='Book',
20+
fields=[
21+
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
22+
('title', models.CharField(max_length=200)),
23+
('author', models.CharField(max_length=200)),
24+
],
25+
options={
26+
'ordering': ['title'],
27+
},
28+
),
29+
migrations.CreateModel(
30+
name='User',
31+
fields=[
32+
('uuid', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)),
33+
('name', models.CharField(max_length=100)),
34+
],
35+
options={
36+
'ordering': ['name'],
37+
},
38+
),
39+
migrations.CreateModel(
40+
name='Cover',
41+
fields=[
42+
('book', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, serialize=False, to='demo_chunkator.Book')),
43+
('code', models.CharField(max_length=20)),
44+
],
45+
),
46+
migrations.CreateModel(
47+
name='Profile',
48+
fields=[
49+
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, serialize=False, to='demo_chunkator.User')),
50+
('avatar', models.CharField(max_length=100)),
51+
],
52+
),
53+
]

demo/demo_chunkator/migrations/__init__.py

Whitespace-only changes.

demo/demo_chunkator/settings.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# -*- coding: utf-8 -*-
2+
from os.path import abspath, dirname, join
3+
_current_dir = dirname(abspath(__file__))
24

35
INSTALLED_APPS = [
46
'demo_chunkator',
@@ -8,7 +10,7 @@
810
DATABASES = {
911
'default': {
1012
'ENGINE': 'django.db.backends.sqlite3',
11-
'NAME': 'demo_chunkator.db',
13+
'NAME': join(_current_dir, 'demo_chunkator.db'),
1214
}
1315
}
1416

0 commit comments

Comments
 (0)