Browse Source

updated README.md, change config default files

/\/ \-/ ❭❬ 4 months ago
parent
commit
2134aa1bd1
6 changed files with 25 additions and 9 deletions
  1. 12
    1
      README.md
  2. 1
    1
      app/__init__.py
  3. 6
    3
      config.py
  4. 3
    3
      gunicorn.py
  5. 1
    0
      manage.py
  6. 2
    1
      run_dev_server.sh

+ 12
- 1
README.md View File

@@ -33,7 +33,7 @@ Experimental webradio CMS based on Flask micro-framework designed for [Radio Rhi
33 33
     >>> CREATE DATABASE rhino;
34 34
     >>> \c rhino;
35 35
     >>> CREATE EXTENSION postgis;
36
-    >>> CREATE USER "rhino";
36
+    >>> CREATE USER "rhino" WITH PASSWORD "mypassword";
37 37
     >>> GRANT ALL ON DATABASE rhino TO "rhino";
38 38
     >>> \q
39 39
 
@@ -59,6 +59,9 @@ Experimental webradio CMS based on Flask micro-framework designed for [Radio Rhi
59 59
     #createlang plpgsql gis
60 60
 
61 61
 ## Init the base
62
+    # If you modified the password "mypassword", change the  
63
+    # url of the variable SQLALCHEMY_DATABASE_URI in the following format
64
+    # postgresql://user:password@hostname/rhino
62 65
 
63 66
     # (Re-)initialize database
64 67
     python3 manage.py nuke
@@ -73,6 +76,14 @@ Experimental webradio CMS based on Flask micro-framework designed for [Radio Rhi
73 76
 
74 77
     python3 manage.py runserver
75 78
 
79
+# Access the main page
80
+
81
+    http://127.0.0.1:5000/site
82
+
83
+# List the routes
84
+
85
+    python3 manage.py routes
86
+
76 87
 ## Admin
77 88
 
78 89
 Admin interface on : http://domain.tld/admin

+ 1
- 1
app/__init__.py View File

@@ -22,7 +22,7 @@ def create_app(config_name):
22 22
     # add haml-like template syntax to jinja_env
23 23
     app.jinja_env.add_extension('hamlish_jinja.HamlishExtension')
24 24
     app.config.from_object(config[config_name])
25
-    app.config['SECRET_KEY'] = 'Thatdumkey'
25
+    app.config['SECRET_KEY'] = 'hackme'
26 26
     config[config_name].init_app(app)
27 27
 
28 28
     mail.init_app(app)

+ 6
- 3
config.py View File

@@ -21,10 +21,11 @@ class DevelopmentConfig(Config):
21 21
     MAIL_USE_TLS = True
22 22
     MAIL_USERNAME = os.environ.get('MAIL_USERNAME')
23 23
     MAIL_PASSWORD = os.environ.get('MAIL_PASSWORD')
24
+    SQLALCHEMY_TRACK_MODIFICATIONS = False
24 25
     # SQLite :
25 26
     #SQLALCHEMY_DATABASE_URI = os.environ.get('DEV_DATABASE_URL') or 'sqlite:///' + os.path.join(basedir, 'data-dev.sqlite')
26 27
     # PostgreSQL :
27
-    SQLALCHEMY_DATABASE_URI = os.environ.get('DEV_DATABASE_URL') or 'postgresql://localhost/rhino'
28
+    SQLALCHEMY_DATABASE_URI = os.environ.get('DEV_DATABASE_URL') or 'postgresql://user:password@localhost/rhino'
28 29
 
29 30
 class TestingConfig(Config):
30 31
     TESTING = True
@@ -33,7 +34,8 @@ class TestingConfig(Config):
33 34
     MAIL_USE_TLS = True
34 35
     MAIL_USERNAME = os.environ.get('MAIL_USERNAME')
35 36
     MAIL_PASSWORD = os.environ.get('MAIL_PASSWORD')
36
-    SQLALCHEMY_DATABASE_URI = os.environ.get('TEST_DATABASE_URL') or 'postgresql://localhost/rhino'
37
+    SQLALCHEMY_DATABASE_URI = os.environ.get('DEV_DATABASE_URL') or 'postgresql://user:password@localhost/rhino'
38
+    SQLALCHEMY_TRACK_MODIFICATIONS = False
37 39
 
38 40
 class ProductionConfig(Config):
39 41
     MAIL_SERVER = 'radiorhino.eu'
@@ -41,7 +43,8 @@ class ProductionConfig(Config):
41 43
     MAIL_USE_TLS = True
42 44
     MAIL_USERNAME = os.environ.get('MAIL_USERNAME')
43 45
     MAIL_PASSWORD = os.environ.get('MAIL_PASSWORD')
44
-    SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or 'postgresql+psycopg2://localhost/rhino'
46
+    SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or 'postgresql+psycopg2://user:password@localhost/rhino'
47
+    SQLALCHEMY_TRACK_MODIFICATIONS = False
45 48
 
46 49
 config = {
47 50
         'development':   DevelopmentConfig,

+ 3
- 3
gunicorn.py View File

@@ -1,11 +1,11 @@
1
-command = "/home/rhino/RhinoRadioCMS/venv/bin/gunicorn"
2
-pythonpath = '/home/rhino/RhinoRadioCMS'
1
+command = "/home/emixam/RhinoRadioCMS/venv/bin/gunicorn"
2
+pythonpath = '/home/emixam/RhinoRadioCMS'
3 3
 
4 4
 user = 'rhino'
5 5
 workers = 2
6 6
 timeout = 30
7 7
 
8
-bind = 'unix:/home/rhino/RhinoRadioCMS/sock'
8
+bind = 'unix:/home/emixam/RhinoRadioCMS/sock'
9 9
 pid = "/run/gunicorn/rhinosite-pid"
10 10
 
11 11
 backlog = 2048

+ 1
- 0
manage.py View File

@@ -18,6 +18,7 @@ manager.add_command('db', MigrateCommand)
18 18
 manager.add_command('shell', Shell(make_context=make_shell_context))
19 19
 manager.add_command('nuke', NukeCommand(db))
20 20
 manager.add_command('lorem', LoremCommand(db))
21
+manager.add_command('routes', RoutesCommand(app))
21 22
 
22 23
 if __name__ == '__main__':
23 24
     manager.run()

+ 2
- 1
run_dev_server.sh View File

@@ -1,4 +1,5 @@
1
-source venv/bin/activate
1
+#!/bin/bash
2
+#source venv/bin/activate
2 3
 export FLASK_APP=app.py
3 4
 export FLASK_DEBUG=1
4 5
 

Loading…
Cancel
Save