Skip to content

Commit a1c3f2f

Browse files
committed
Release v1.0.8
1 parent a1648a5 commit a1c3f2f

File tree

13 files changed

+119
-108
lines changed

13 files changed

+119
-108
lines changed

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
DEBUG=True
22

33
FLASK_APP=run.py
4-
FLASK_ENV=development
4+
FLASK_DEBUG=1
55

66
ASSETS_ROOT=/static/assets
77

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Change Log
22

3+
## [1.0.8] 2023-10-07
4+
### Changes
5+
6+
- Update Dependencies
7+
- Silent fallback to SQLite
8+
- CI/CD for Render
9+
310
## [1.0.7] 2022-06-01
411
### Improvements
512

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.9
1+
FROM python:3.10
22

33
# set environment variables
44
ENV PYTHONDONTWRITEBYTECODE 1

README.md

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,23 @@ Open-source **[Flask Dashboard](https://appseed.us/admin-dashboards/flask/)** ge
44

55
- 👉 [CoreUI Flask](https://appseed.us/product/coreui/flask/) - product page
66
- 👉 [CoreUI Flask](https://flask-coreui.appseed-srv1.com/) - LIVE Deployment
7-
- 👉 [Complete documentation](https://docs.appseed.us/products/flask-dashboards/coreui) - `Learn how to use and update the product`
87

98
<br />
109

11-
## [Black Friday](https://appseed.us/discounts/) - `75%OFF`
10+
## ✅ Features
1211

13-
> The campaign is active until `30.NOV` and applies to all products and licenses.
14-
15-
[![AppSeed - Black Friday 2022 Campaign, 75% OFF Discount (all products).](https://user-images.githubusercontent.com/51070104/201829599-9fe6bdd7-3f19-46f3-9115-962eeb13bf29.jpg)](https://appseed.us/discounts/)
16-
17-
<br />
18-
19-
> 🚀 Built with [App Generator](https://appseed.us/generator/), Timestamp: `2022-06-01 09:08`
20-
21-
-`Up-to-date dependencies`
22-
- ✅ Database: `sqlite`
23-
-`DB Tools`: SQLAlchemy ORM, Flask-Migrate (schema migrations)
24-
- ✅ Session-Based authentication (via **flask_login**), Forms validation
25-
-`Docker`
26-
27-
<br />
12+
- `Up-to-date dependencies`
13+
- Database: `sqlite`
14+
- `DB Tools`: SQLAlchemy ORM, Flask-Migrate (schema migrations)
15+
- Session-Based authentication (via **flask_login**), Forms validation
16+
- `Docker`
17+
- CI/CD Flow via Render
2818

2919
![CoreUI Dashboard - Starter generated by AppSeed.](https://user-images.githubusercontent.com/51070104/171336361-b125ca1d-8936-4f4a-b662-9e45ee25f404.png)
3020

3121
<br />
3222

33-
## Start the app in Docker
23+
## Start in `Docker`
3424

3525
> 👉 **Step 1** - Download the code from the GH repository (using `GIT`)
3626
@@ -49,9 +39,8 @@ $ docker-compose up --build
4939

5040
Visit `http://localhost:5085` in your browser. The app should be up & running.
5141

52-
<br />
5342

54-
## ✨ How to use it
43+
## ✅ Manual Build
5544

5645
> Download the code
5746
@@ -141,7 +130,7 @@ By default, the app redirects guest users to authenticate. In order to access th
141130

142131
<br />
143132

144-
## ✨ Code-base structure
133+
## ✅ Codebase
145134

146135
The project is coded using blueprints, app factory pattern, dual configuration profile (development and production) and an intuitive structure presented bellow:
147136

@@ -194,7 +183,7 @@ The project is coded using blueprints, app factory pattern, dual configuration p
194183

195184
<br />
196185

197-
## PRO Version
186+
## PRO Version
198187

199188
> For more components, pages and priority on support, feel free to take a look at this amazing starter:
200189
@@ -203,8 +192,6 @@ Soft UI Dashboard is a premium Bootstrap 5 Design now available for download in
203192
- 👉 [Soft UI Dashboard PRO Flask](https://appseed.us/product/soft-ui-dashboard-pro/flask/) - Product Page
204193
- 👉 [Soft UI Dashboard PRO Flask](https://flask-soft-ui-dashboard-pro.appseed-srv1.com/) - LIVE Demo
205194

206-
<br >
207-
208195
![Soft UI Dashboard PRO - Starter generated by AppSeed.](https://user-images.githubusercontent.com/51070104/170829870-8acde5af-849a-4878-b833-3be7e67cff2d.png)
209196

210197
<br />

apps/__init__.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
Copyright (c) 2019 - present AppSeed.us
44
"""
55

6+
import os
7+
68
from flask import Flask
79
from flask_login import LoginManager
810
from flask_sqlalchemy import SQLAlchemy
@@ -28,7 +30,18 @@ def configure_database(app):
2830

2931
@app.before_first_request
3032
def initialize_database():
31-
db.create_all()
33+
try:
34+
db.create_all()
35+
except Exception as e:
36+
37+
print('> Error: DBMS Exception: ' + str(e) )
38+
39+
# fallback to SQLite
40+
basedir = os.path.abspath(os.path.dirname(__file__))
41+
app.config['SQLALCHEMY_DATABASE_URI'] = SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'db.sqlite3')
42+
43+
print('> Fallback to SQLite ')
44+
db.create_all()
3245

3346
@app.teardown_request
3447
def shutdown_session(exception=None):

apps/config.py

Lines changed: 43 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,57 @@
33
Copyright (c) 2019 - present AppSeed.us
44
"""
55

6-
import os
6+
import os, random, string
77

88
class Config(object):
99

1010
basedir = os.path.abspath(os.path.dirname(__file__))
1111

12+
# Assets Management
13+
ASSETS_ROOT = os.getenv('ASSETS_ROOT', '/static/assets')
14+
1215
# Set up the App SECRET_KEY
13-
# SECRET_KEY = config('SECRET_KEY' , default='S#perS3crEt_007')
14-
SECRET_KEY = os.getenv('SECRET_KEY', 'S#perS3crEt_007')
16+
SECRET_KEY = os.getenv('SECRET_KEY', None)
17+
if not SECRET_KEY:
18+
SECRET_KEY = ''.join(random.choice( string.ascii_lowercase ) for i in range( 32 ))
1519

16-
# This will create a file in <app> FOLDER
17-
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'db.sqlite3')
18-
SQLALCHEMY_TRACK_MODIFICATIONS = False
20+
SQLALCHEMY_TRACK_MODIFICATIONS = False
1921

20-
# Assets Management
21-
ASSETS_ROOT = os.getenv('ASSETS_ROOT', '/static/assets')
22+
DB_ENGINE = os.getenv('DB_ENGINE' , None)
23+
DB_USERNAME = os.getenv('DB_USERNAME' , None)
24+
DB_PASS = os.getenv('DB_PASS' , None)
25+
DB_HOST = os.getenv('DB_HOST' , None)
26+
DB_PORT = os.getenv('DB_PORT' , None)
27+
DB_NAME = os.getenv('DB_NAME' , None)
28+
29+
USE_SQLITE = True
30+
31+
# try to set up a Relational DBMS
32+
if DB_ENGINE and DB_NAME and DB_USERNAME:
33+
34+
try:
35+
36+
# Relational DBMS: PSQL, MySql
37+
SQLALCHEMY_DATABASE_URI = '{}://{}:{}@{}:{}/{}'.format(
38+
DB_ENGINE,
39+
DB_USERNAME,
40+
DB_PASS,
41+
DB_HOST,
42+
DB_PORT,
43+
DB_NAME
44+
)
45+
46+
USE_SQLITE = False
47+
48+
except Exception as e:
49+
50+
print('> Error: DBMS Exception: ' + str(e) )
51+
print('> Fallback to SQLite ')
52+
53+
if USE_SQLITE:
54+
55+
# This will create a file in <app> FOLDER
56+
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'db.sqlite3')
2257

2358
class ProductionConfig(Config):
2459
DEBUG = False
@@ -28,16 +63,6 @@ class ProductionConfig(Config):
2863
REMEMBER_COOKIE_HTTPONLY = True
2964
REMEMBER_COOKIE_DURATION = 3600
3065

31-
# PostgreSQL database
32-
SQLALCHEMY_DATABASE_URI = '{}://{}:{}@{}:{}/{}'.format(
33-
os.getenv('DB_ENGINE' , 'mysql'),
34-
os.getenv('DB_USERNAME' , 'appseed_db_usr'),
35-
os.getenv('DB_PASS' , 'pass'),
36-
os.getenv('DB_HOST' , 'localhost'),
37-
os.getenv('DB_PORT' , 3306),
38-
os.getenv('DB_NAME' , 'appseed_db')
39-
)
40-
4166

4267
class DebugConfig(Config):
4368
DEBUG = True

build.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
# exit on error
3+
set -o errexit
4+
5+
python -m pip install --upgrade pip
6+
7+
pip install -r requirements.txt

env.sample

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ DEBUG=True
33

44
# Flask ENV
55
FLASK_APP=run.py
6-
FLASK_ENV=development
6+
FLASK_DEBUG=1
77
SECRET_KEY=YOUR_SUPER_KEY
88

99
# If DEBUG=False (production mode)
10-
DB_ENGINE=mysql
11-
DB_NAME=appseed_db
12-
DB_HOST=localhost
13-
DB_PORT=3306
14-
DB_USERNAME=appseed_db_usr
15-
DB_PASS=<STRONG_PASS>
10+
# DB_ENGINE=mysql
11+
# DB_NAME=appseed_db
12+
# DB_HOST=localhost
13+
# DB_PORT=3306
14+
# DB_USERNAME=appseed_db_usr
15+
# DB_PASS=<STRONG_PASS>

log.json

Lines changed: 0 additions & 23 deletions
This file was deleted.

package.json

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)