Browse Source

fixed README.md, added TABLES.rst for table description, and structure.dot for a graphviz representation of tables

/\/ \-/ ❭❬ 7 months ago
parent
commit
01248c780e
8 changed files with 2295 additions and 59 deletions
  1. 2
    1
      .gitignore
  2. 121
    0
      README.html
  3. 65
    50
      README.md
  4. 1954
    0
      TABLES.pdf
  5. 141
    8
      TABLES.rst
  6. 0
    0
      app/static/podcasts/.gitkeep
  7. 12
    0
      structure.dot
  8. BIN
      structure.png

+ 2
- 1
.gitignore View File

2
 *.pyc
2
 *.pyc
3
 .DS_Store
3
 .DS_Store
4
 app/uploads/*
4
 app/uploads/*
5
+!app/uploads/.gitkeep
5
 app/static/podcasts/*
6
 app/static/podcasts/*
6
-venv/*
7
+!app/static/podcasts/.gitkeep
7
 doc/_build/
8
 doc/_build/
8
 .sass-cache
9
 .sass-cache
9
 alchemydumps/*
10
 alchemydumps/*

+ 121
- 0
README.html View File

1
+<h1>Rhino Radio CMS</h1>
2
+
3
+<p>Experimental webradio CMS based on Flask micro-framework designed for <a href="http://radiorhino.eu">Radio Rhino</a> with YunoHost (not absolutely required but necessary to protect admin).</p>
4
+
5
+<h2>Install</h2>
6
+
7
+<pre><code># On Debian-based distros
8
+sudo apt-get install python3 python3-pip python3-virtualenv virtualenv
9
+
10
+###
11
+# If you want to create a virtual environment (i.e. for development purpose)
12
+
13
+mkdir ~/.pyvenv
14
+virtualenv -p python3 ~/.pyvenv/rhinoradiocms
15
+
16
+source ~/.pyvenv/rhinoradiocms/bin/activate
17
+
18
+#
19
+###
20
+
21
+###
22
+# If you want to use a local postgresql server
23
+
24
+# PostgreSQL and GIS (geographic db)
25
+sudo apt-get install python3-dev postgresql-9.6 postgresql-server-dev-9.6 postgis
26
+
27
+# Start PostgreSQL
28
+systemctl start postgresql
29
+
30
+sudo su postgres
31
+psql
32
+&gt;&gt;&gt; CREATE DATABASE rhino;
33
+&gt;&gt;&gt; \c rhino;
34
+&gt;&gt;&gt; CREATE EXTENSION postgis;
35
+&gt;&gt;&gt; CREATE USER "rhino";
36
+&gt;&gt;&gt; GRANT ALL ON DATABASE rhino TO "rhino";
37
+&gt;&gt;&gt; \q
38
+
39
+#
40
+###
41
+
42
+###
43
+# If you want to compile Sass CSS on your machine
44
+sudo apt-get install ruby ruby-dev
45
+
46
+gem install --user-install sass
47
+# or
48
+sudo gem install sass
49
+
50
+#
51
+###
52
+
53
+
54
+# WARNING installing with pip will require administrator rights if not installing in a virtual environment, or install with --user
55
+pip install -r requirements.txt
56
+
57
+# if needed :
58
+#createlang plpgsql gis
59
+</code></pre>
60
+
61
+<h2>Init the base</h2>
62
+
63
+<pre><code># (Re-)initialize database
64
+python3 manage.py nuke
65
+
66
+# Feed database with random placeholder values
67
+python3 manage.py lorem
68
+</code></pre>
69
+
70
+<h2>Develop</h2>
71
+
72
+<h1>Run dev server</h1>
73
+
74
+<pre><code>python3 manage.py runserver
75
+</code></pre>
76
+
77
+<h2>Admin</h2>
78
+
79
+<p>Admin interface on : http://domain.tld/admin</p>
80
+
81
+<h2>Deployment with Gunicorn</h2>
82
+
83
+<h1>Install Gunicorn</h1>
84
+
85
+<pre><code>pip3 install Gunicorn
86
+</code></pre>
87
+
88
+<p>More to come.</p>
89
+
90
+<p>Uncomment '#scheme="https"' in views.py</p>
91
+
92
+<p>Add environment variables to /lib/systemd/system :</p>
93
+
94
+<ul>
95
+<li>AIRTIME<em>API</em>KEY</li>
96
+<li>STREAM_URL</li>
97
+<li>SECRET_KEY</li>
98
+<li>FLASK_CONFIG='production'</li>
99
+</ul>
100
+
101
+<p>If your podcast files are on a distant machine : set an autofs + sshfs on app/static/podcasts :
102
+<code>bash
103
+sshfs user@distant-ip:/podcasts/dir/
104
+</code></p>
105
+
106
+<h2>Prod upgrade</h2>
107
+
108
+<pre><code>git pull
109
+git merge origin master
110
+sass app/static/scss/style.scss:app/static/css/style.css --style compressed
111
+service rhinosite restart
112
+</code></pre>
113
+
114
+<h2>Doc</h2>
115
+
116
+<p>Eeeeeeeh... Soon™.</p>
117
+
118
+<h1>Install Sphinx</h1>
119
+
120
+<pre><code>pip3 install Sphinx
121
+</code></pre>

+ 65
- 50
README.md View File

4
 
4
 
5
 ## Install
5
 ## Install
6
 
6
 
7
-```bash
8
-# On Debian/Ubuntu/Mint
9
-sudo apt-get install python-virtualenv
10
 
7
 
11
-virtualenv -p python3 venv
12
-source venv/bin/activate
8
+    # On Debian-based distros
9
+    sudo apt-get install python3 python3-pip python3-virtualenv virtualenv
13
 
10
 
14
-# PostgreSQL and GIS (geographic db) + SASS
15
-sudo apt install python3-dev postgresql-9.4 postgresql-server-dev-9.4 postgis
16
-gem install sass
11
+    ###
12
+    # If you want to create a virtual environment (i.e. for development purpose)
17
 
13
 
18
-pip3 install -r requirements.txt
14
+    mkdir ~/.pyvenv
15
+    virtualenv -p python3 ~/.pyvenv/rhinoradiocms
19
 
16
 
20
-# Start PostgreSQL
21
-systemctl start postgresql
17
+    source ~/.pyvenv/rhinoradiocms/bin/activate
22
 
18
 
23
-# if needed :
24
-#createlang plpgsql gis
19
+    #
20
+    ###
25
 
21
 
26
-sudo su postgres
27
-psql
28
->>> CREATE DATABASE rhino;
29
->>> \c rhino;
30
->>> CREATE EXTENSION postgis;
31
->>> GRANT ALL ON DATABASE rhino TO "user";
32
->>> \q
22
+    ###
23
+    # If you want to use a local postgresql server
33
 
24
 
34
-# Path a few stuff..
35
-mkdir app/static/podcasts
25
+    # PostgreSQL and GIS (geographic db)
26
+    sudo apt-get install python3-dev postgresql-9.6 postgresql-server-dev-9.6 postgis
36
 
27
 
37
-# Replace 'xrange' by 'range' in lorem_ipsum :
38
-vim venv/lib/python*/site-packages/forgery_py/forgery/lorem_ipsum.py
28
+    # Start PostgreSQL
29
+    systemctl start postgresql
30
+
31
+    sudo su postgres
32
+    psql
33
+    >>> CREATE DATABASE rhino;
34
+    >>> \c rhino;
35
+    >>> CREATE EXTENSION postgis;
36
+    >>> CREATE USER "rhino";
37
+    >>> GRANT ALL ON DATABASE rhino TO "rhino";
38
+    >>> \q
39
+
40
+    #
41
+    ###
42
+
43
+    ###
44
+    # If you want to compile Sass CSS on your machine
45
+    sudo apt-get install ruby ruby-dev
46
+
47
+    gem install --user-install sass
48
+    # or
49
+    sudo gem install sass
50
+
51
+    #
52
+    ###
39
 
53
 
40
-```
54
+
55
+    # WARNING installing with pip will require administrator rights if not installing in a virtual environment, or install with --user
56
+    pip install -r requirements.txt
57
+
58
+    # if needed :
59
+    #createlang plpgsql gis
41
 
60
 
42
 ## Init the base
61
 ## Init the base
43
 
62
 
44
-```
45
-# (Re-)initialize database
46
-python3 manage.py nuke
63
+    # (Re-)initialize database
64
+    python3 manage.py nuke
65
+
66
+    # Feed database with random placeholder values
67
+    python3 manage.py lorem
47
 
68
 
48
-# Feed database with random placeholder values
49
-python3 manage.py lorem
50
-```
51
 
69
 
52
 ## Develop
70
 ## Develop
53
 
71
 
54
-```bash
55
 # Run dev server
72
 # Run dev server
56
-python3 manage.py runserver
57
-```
73
+
74
+    python3 manage.py runserver
58
 
75
 
59
 ## Admin
76
 ## Admin
60
 
77
 
62
 
79
 
63
 ## Deployment with Gunicorn
80
 ## Deployment with Gunicorn
64
 
81
 
65
-```bash
66
 # Install Gunicorn
82
 # Install Gunicorn
67
-pip3 install Gunicorn
68
-```
83
+
84
+    pip3 install Gunicorn
85
+
69
 More to come.
86
 More to come.
70
 
87
 
71
 Uncomment '#scheme="https"' in views.py
88
 Uncomment '#scheme="https"' in views.py
72
 
89
 
73
 Add environment variables to /lib/systemd/system :
90
 Add environment variables to /lib/systemd/system :
74
-AIRTIME_API_KEY
75
-STREAM_URL
76
-SECRET_KEY
77
-FLASK_CONFIG='production'
91
+
92
+- AIRTIME_API_KEY
93
+- STREAM_URL
94
+- SECRET_KEY
95
+- FLASK_CONFIG='production'
78
 
96
 
79
 If your podcast files are on a distant machine : set an autofs + sshfs on app/static/podcasts :
97
 If your podcast files are on a distant machine : set an autofs + sshfs on app/static/podcasts :
80
 ```bash
98
 ```bash
82
 ```
100
 ```
83
 
101
 
84
 ## Prod upgrade
102
 ## Prod upgrade
85
-```bash
86
-git pull
87
-git merge origin master
88
-sass app/static/scss/style.scss:app/static/css/style.css --style compressed
89
-service rhinosite restart
90
-```
91
 
103
 
104
+    git pull
105
+    git merge origin master
106
+    sass app/static/scss/style.scss:app/static/css/style.css --style compressed
107
+    service rhinosite restart
92
 
108
 
93
 ## Doc
109
 ## Doc
94
 
110
 
95
 Eeeeeeeh... Soon™.
111
 Eeeeeeeh... Soon™.
96
 
112
 
97
-```bash
98
 # Install Sphinx
113
 # Install Sphinx
99
-pip3 install Sphinx
100
-```
114
+
115
+    pip3 install Sphinx

+ 1954
- 0
TABLES.pdf
File diff suppressed because it is too large
View File


+ 141
- 8
TABLES.rst View File

1
 ==================
1
 ==================
2
 RADIO RHINO TABLES
2
 RADIO RHINO TABLES
3
 ==================
3
 ==================
4
-
5
-list postgresql tables : 
4
+list postgresql tables
5
+----------------------
6
 
6
 
7
 ----------
7
 ----------
8
 blog_posts
8
 blog_posts
9
 ----------
9
 ----------
10
-----------------------
11
-blog_posts_collectives
12
-----------------------
13
------------------------
14
-blog_posts_contributors
15
------------------------
10
+
11
+============ ============
12
+field        type
13
+============ ============
14
+**id**       integer
15
+name         varchar(256)
16
+description  text
17
+timestamp    timestamp
18
+*channel_id* integer
19
+============ ============
20
+
21
+**External relationships**
22
+
23
+- relation n->n between blog_posts and collectives
24
+- relation n->n between blog_posts and contributors
25
+
16
 --------
26
 --------
17
 channels
27
 channels
18
 --------
28
 --------
29
+
30
+=========== ============
31
+field        type
32
+=========== ============
33
+**id**      integer
34
+name        varchar(128)
35
+description text
36
+license     varchar(256)
37
+mood        varchar(128)
38
+music       bool
39
+night       bool
40
+=========== ============
41
+
42
+**External relationships**
43
+
44
+- relation 1->n between channels and blog_posts (a blog_post can have only one channel)
45
+- relation n->n between channels and collectives
46
+- relation n->n between channels and contributors
47
+- relation 1->n between channels and events 
48
+- relation 1->n between channels and pages 
49
+- relation 1->n between channels and podcasts
50
+- relation 1->n between channels and sections
51
+- relation 1->n between channels and tags
52
+
19
 ----------------
53
 ----------------
20
 channels_authors
54
 channels_authors
21
 ----------------
55
 ----------------
22
 --------------------
56
 --------------------
23
 channels_collectives
57
 channels_collectives
24
 --------------------
58
 --------------------
59
+
25
 ---------------------
60
 ---------------------
26
 channels_contributors
61
 channels_contributors
27
 ---------------------
62
 ---------------------
63
+
64
+
28
 -----------
65
 -----------
29
 collectives
66
 collectives
30
 -----------
67
 -----------
68
+
69
+=========== ============
70
+field       type
71
+=========== ============
72
+**id**      integer
73
+name        varchar(128)
74
+description text
75
+email       varchar(256)
76
+website     varchar(256)
77
+=========== ============
78
+
31
 ------------------------
79
 ------------------------
32
 collectives_contributors
80
 collectives_contributors
33
 ------------------------
81
 ------------------------
82
+
34
 ------------
83
 ------------
35
 contributors
84
 contributors
36
 ------------
85
 ------------
86
+
87
+=========== ============
88
+field       type
89
+=========== ============
90
+**id**      integer
91
+name        varchar(128)
92
+status      varchar(128)
93
+description text
94
+email       varchar(256)
95
+website     varchar(256)
96
+=========== ============
97
+
98
+
37
 ------
99
 ------
38
 events
100
 events
39
 ------
101
 ------
102
+
103
+================ ============
104
+field            type
105
+================ ============
106
+**id**           integer
107
+name             varchar(128)
108
+description      text
109
+place            varchar(128)
110
+begin            timestamp
111
+end              timestamp
112
+*channel_id*     integer
113
+*collective__id* integer
114
+*podcast_id*     integer
115
+live_show        bool
116
+================ ============
117
+
40
 -----
118
 -----
41
 pages
119
 pages
42
 -----
120
 -----
121
+
122
+============ ============
123
+field        type
124
+============ ============
125
+**id**       integer
126
+name         varchar(128)
127
+description  text
128
+*channel_id* integer
129
+============ ============
130
+
43
 --------
131
 --------
44
 podcasts
132
 podcasts
45
 --------
133
 --------
134
+
135
+============ ============
136
+field         type
137
+============ ============
138
+**id**       integer
139
+name         varchar(128)
140
+description  text
141
+date         date
142
+timestamp    timestamp
143
+*channel_id* integer
144
+link         varchar(256)
145
+license      varchar(256)
146
+mood         varchar(128)
147
+music        bool
148
+night        bool
149
+============ ============
150
+
151
+
152
+
46
 ----------------
153
 ----------------
47
 podcasts_authors
154
 podcasts_authors
48
 ----------------
155
 ----------------
55
 --------
162
 --------
56
 sections
163
 sections
57
 --------
164
 --------
165
+
166
+============ ============
167
+field         type
168
+============ ============
169
+**id**       integer
170
+name         varchar(128)
171
+description  text
172
+timestamp    timestamp
173
+begin        time
174
+end          time
175
+*channel_id* integer
176
+*podcast_id* integer
177
+mood         varchar(128)
178
+============ ============
179
+
58
 ----------------
180
 ----------------
59
 sections_authors
181
 sections_authors
60
 ----------------
182
 ----------------
67
 ----
189
 ----
68
 tags
190
 tags
69
 ----
191
 ----
192
+
193
+================ ============
194
+field            type
195
+================ ============
196
+**id**           integer
197
+name             varchar(129)
198
+*channel_id*     integer
199
+*collective__id* integer
200
+*podcast_id*     integer
201
+*section_id*     integer
202
+================ ============

+ 0
- 0
app/static/podcasts/.gitkeep View File


+ 12
- 0
structure.dot View File

1
+digraph {
2
+    blog_posts -> { collectives contributors channels[headlabel="0,n" taillabel="1"] }
3
+    channels -> { contributors collectives }
4
+    channels -> contributors [fontcolor="red" taillabel="authors"]
5
+    collectives -> { contributors }
6
+    contributors -> channels [headlabel="0,n" taillabel="0,n" ]
7
+    events -> channels[headlabel="1,1" taillabel="0,n" ]
8
+    pages -> channels[headlabel="1,1" taillabel="0,n" ]
9
+    podcasts -> { contributors contributors collectives contributors }
10
+    sections -> { contributors collectives }
11
+    tags -> channels
12
+}

BIN
structure.png View File


Loading…
Cancel
Save