Browse Source

updated README.md, change config default files

/\/ \-/ ❭❬ 5 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
     >>> CREATE DATABASE rhino;
33
     >>> CREATE DATABASE rhino;
34
     >>> \c rhino;
34
     >>> \c rhino;
35
     >>> CREATE EXTENSION postgis;
35
     >>> CREATE EXTENSION postgis;
36
-    >>> CREATE USER "rhino";
36
+    >>> CREATE USER "rhino" WITH PASSWORD "mypassword";
37
     >>> GRANT ALL ON DATABASE rhino TO "rhino";
37
     >>> GRANT ALL ON DATABASE rhino TO "rhino";
38
     >>> \q
38
     >>> \q
39
 
39
 
59
     #createlang plpgsql gis
59
     #createlang plpgsql gis
60
 
60
 
61
 ## Init the base
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
     # (Re-)initialize database
66
     # (Re-)initialize database
64
     python3 manage.py nuke
67
     python3 manage.py nuke
73
 
76
 
74
     python3 manage.py runserver
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
 ## Admin
87
 ## Admin
77
 
88
 
78
 Admin interface on : http://domain.tld/admin
89
 Admin interface on : http://domain.tld/admin

+ 1
- 1
app/__init__.py View File

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

+ 6
- 3
config.py View File

21
     MAIL_USE_TLS = True
21
     MAIL_USE_TLS = True
22
     MAIL_USERNAME = os.environ.get('MAIL_USERNAME')
22
     MAIL_USERNAME = os.environ.get('MAIL_USERNAME')
23
     MAIL_PASSWORD = os.environ.get('MAIL_PASSWORD')
23
     MAIL_PASSWORD = os.environ.get('MAIL_PASSWORD')
24
+    SQLALCHEMY_TRACK_MODIFICATIONS = False
24
     # SQLite :
25
     # SQLite :
25
     #SQLALCHEMY_DATABASE_URI = os.environ.get('DEV_DATABASE_URL') or 'sqlite:///' + os.path.join(basedir, 'data-dev.sqlite')
26
     #SQLALCHEMY_DATABASE_URI = os.environ.get('DEV_DATABASE_URL') or 'sqlite:///' + os.path.join(basedir, 'data-dev.sqlite')
26
     # PostgreSQL :
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
 class TestingConfig(Config):
30
 class TestingConfig(Config):
30
     TESTING = True
31
     TESTING = True
33
     MAIL_USE_TLS = True
34
     MAIL_USE_TLS = True
34
     MAIL_USERNAME = os.environ.get('MAIL_USERNAME')
35
     MAIL_USERNAME = os.environ.get('MAIL_USERNAME')
35
     MAIL_PASSWORD = os.environ.get('MAIL_PASSWORD')
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
 class ProductionConfig(Config):
40
 class ProductionConfig(Config):
39
     MAIL_SERVER = 'radiorhino.eu'
41
     MAIL_SERVER = 'radiorhino.eu'
41
     MAIL_USE_TLS = True
43
     MAIL_USE_TLS = True
42
     MAIL_USERNAME = os.environ.get('MAIL_USERNAME')
44
     MAIL_USERNAME = os.environ.get('MAIL_USERNAME')
43
     MAIL_PASSWORD = os.environ.get('MAIL_PASSWORD')
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
 config = {
49
 config = {
47
         'development':   DevelopmentConfig,
50
         'development':   DevelopmentConfig,

+ 3
- 3
gunicorn.py View File

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
 user = 'rhino'
4
 user = 'rhino'
5
 workers = 2
5
 workers = 2
6
 timeout = 30
6
 timeout = 30
7
 
7
 
8
-bind = 'unix:/home/rhino/RhinoRadioCMS/sock'
8
+bind = 'unix:/home/emixam/RhinoRadioCMS/sock'
9
 pid = "/run/gunicorn/rhinosite-pid"
9
 pid = "/run/gunicorn/rhinosite-pid"
10
 
10
 
11
 backlog = 2048
11
 backlog = 2048

+ 1
- 0
manage.py View File

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

+ 2
- 1
run_dev_server.sh View File

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

Loading…
Cancel
Save