Skip to content

Commit

Permalink
Code CleanUP (Minor)
Browse files Browse the repository at this point in the history
  • Loading branch information
app-generator committed Dec 6, 2022
1 parent 2447033 commit fabb1eb
Show file tree
Hide file tree
Showing 12 changed files with 60 additions and 107 deletions.
4 changes: 2 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ FLASK_ENV=development

ASSETS_ROOT=/static/assets

#MONGO_DB=materialkit-flask
#MONGO_HOST=mongodb://localhost:27017
# MONGO_DB=materialkit-flask
# MONGO_HOST=mongodb://localhost:27017
68 changes: 9 additions & 59 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,56 +1,32 @@
# [Flask Material Kit](https://appseed.us/product/material-kit/flask/)
# [Flask & Mongo](https://github.com/app-generator/sample-flask-mongo) `sample`

`Open-Source` seed project generated by AppSeed in **Flask** Framework on top of **[Material Kit](https://appseed.us/product/material-kit/flask/)** design. Designed for those who like bold elements and beautiful websites, **Material Kit 2** is ready to help you create stunning websites and web apps. `Material Kit 2` is built with over 60 frontend individual elements, like buttons, inputs, navbars, nav tabs, cards, or alerts, giving you the freedom of choosing and combining.

- 👉 [Flask Material Kit](https://appseed.us/product/material-kit/flask/) - product page
- 👉 [Flask Material Kit](https://flask-material-kit.appseed-srv1.com/) - LIVE App
- ✅ Compatible with [LIVE Deployer](https://appseed.us/go-live/)
- [Deploy Flask MKit with Drag & Drop](https://www.youtube.com/watch?v=I8G-0AO64Yo) - `video material`
- 👉 [Flask Material Kit](https://flask-material-kit.appseed-srv1.com/) - `LIVE App`
- 🚀 [Support](https://appseed.us/support/) - via `Email` & `Discord`

<br />

> 🚀 Built with [App Generator](https://appseed.us/generator/), Timestamp: `2022-06-08 12:24`
> Features:
-`Up-to-date dependencies`
-Database: `sqlite`
-`DB Tools`: SQLAlchemy ORM, Flask-Migrate (schema migrations)
-Persistence: `Mongo`
- ✅ DB Tools: `Flask-MongoEngine`
- ✅ Session-Based authentication (via **flask_login**), Forms validation
-`Docker`

<br />

![Material Kit - Starter generated by AppSeed.](https://user-images.githubusercontent.com/51070104/167396765-c88b7a95-155f-4236-8691-7b80fa2d9cd9.png)

<br />

## ✨ Start the app in Docker

> 👉 **Step 1** - Download the code from the GH repository (using `GIT`)
```bash
$ git clone https://github.com/app-generator/flask-material-kit.git
$ cd flask-material-kit
```

<br />

> 👉 **Step 2** - Start the APP in `Docker`
```bash
$ docker-compose up --build
```

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

<br />

## ✨ How to use it

> Download the code
```bash
$ git clone https://github.com/app-generator/flask-material-kit.git
$ cd flask-material-kit
$ git clone https://github.com/app-generator/sample-flask-mongo.git
$ cd sample-flask-mongo
```

<br />
Expand Down Expand Up @@ -134,16 +110,6 @@ By default, the app redirects guest users to authenticate. In order to access th

<br />

## `Go LIVE` via [LIVE Deployer](https://appseed.us/go-live/)

> This video explains `how to deploy` the product LIVE using a `Drag & Drop` gesture.
<br />

https://user-images.githubusercontent.com/51070104/202416162-885c30d3-5066-40cb-abcd-1668689c9463.mp4

<br />

## ✨ Code-base structure

The project is coded using blueprints, app factory pattern, dual configuration profile (development and production) and an intuitive structure presented bellow:
Expand Down Expand Up @@ -197,21 +163,5 @@ The project is coded using blueprints, app factory pattern, dual configuration p

<br />

## PRO Version

> For more components, pages and priority on support, feel free to take a look at this amazing starter:
**Material Kit 2** is a premium design crafted by the `Creative-Tim` agency on top of Bootstrap 5 Framework. Designed for those who like bold elements and beautiful websites, Material Kit 2 is made of hundreds of elements, designed blocks, and fully coded pages built with an impressive level of quality.

- 👉 [Flask Material Kit2 PRO](https://appseed.us/product/material-kit2-pro/flask/) - product page
-`Enhanced UI` - more pages and components
-`Priority` on support

<br >

![Mk2 PRO - Premium Seed project by AppSeed.](https://user-images.githubusercontent.com/51070104/168224733-b054bb46-d454-4aea-bb94-2d01bf4760d2.png)

<br />

---
[Flask Material Kit](https://appseed.us/product/material-kit/flask/) - Open-source starter generated by **[App Generator](https://appseed.us/generator/)**.
[Flask & Mongo](https://github.com/app-generator/sample-flask-mongo) `sample` - Open-source starter generated by **[App Generator](https://appseed.us/generator/)**.
14 changes: 0 additions & 14 deletions apps/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from importlib import import_module
from flask_mongoengine import MongoEngine,MongoEngineSessionInterface


db = MongoEngine()
login_manager = LoginManager()

Expand All @@ -24,22 +23,9 @@ def register_blueprints(app):
module = import_module('apps.{}.routes'.format(module_name))
app.register_blueprint(module.blueprint)


# def configure_database(app):

# @app.before_first_request
# def initialize_database():
# db.create_all()

# @app.teardown_request
# def shutdown_session(exception=None):
# db.session.remove()


def create_app(config):
app = Flask(__name__)
app.config.from_object(config)
register_extensions(app)
register_blueprints(app)
# configure_database(app)
return app
5 changes: 3 additions & 2 deletions apps/authentication/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,13 @@ def login():

@blueprint.route('/register', methods=['GET', 'POST'])
def register():

create_account_form = CreateAccountForm(request.form,instance=Users())

if 'register' in request.form:

username = request.form['username']
email = request.form['email']
email = request.form['email']
password = request.form['password']

# Check usename exists
Expand Down Expand Up @@ -100,7 +102,6 @@ def logout():
logout_user()
return redirect(url_for('authentication_blueprint.login'))


# Errors

@login_manager.unauthorized_handler
Expand Down
2 changes: 1 addition & 1 deletion apps/templates/accounts/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<div class="card-header p-0 position-relative mt-n4 mx-3 z-index-2">
<div class="bg-gradient-primary shadow-primary border-radius-lg py-3 pe-1">
<h4 class="text-white font-weight-bolder text-center mt-2 mb-0">
Flask Material Kit
Flask & MongoDB
</h4>
<div class="row mt-3">
<p class="mb-0 text-white text-center">
Expand Down
2 changes: 1 addition & 1 deletion apps/templates/accounts/register.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<div class="card-header p-0 position-relative mt-n4 mx-3 z-index-2">
<div class="bg-gradient-primary shadow-primary border-radius-lg py-3 pe-1">
<h4 class="text-white font-weight-bolder text-center mt-2 mb-0">
Flask Material Kit
Flask & MongoDB
</h4>
<div class="row mt-3">
<p class="mb-0 text-white text-center">
Expand Down
4 changes: 2 additions & 2 deletions apps/templates/includes/footer-auth.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
<div class="col-12 col-md-6">
<ul class="nav nav-footer justify-content-center justify-content-lg-end">
<li class="nav-item">
<a href="https://github.com/app-generator/jinja-material-kit" class="nav-link text-white" target="_blank">Sources</a>
<a href="https://github.com/app-generator/sample-flask-mongo" class="nav-link text-white" target="_blank">Sources</a>
</li>
<li class="nav-item">
<a href="https://appseed.us/support" class="nav-link text-white" target="_blank">Support</a>
<a href="https://appseed.us/support/" class="nav-link text-white" target="_blank">Support</a>
</li>
<li class="nav-item">
<a href="https://appseed.us" class="nav-link text-white" target="_blank">AppSeed</a>
Expand Down
2 changes: 1 addition & 1 deletion apps/templates/includes/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class=" row">
<div class="col-md-3 mb-4 ms-auto">
<div>
<a href="https://appseed.us/apps/flask-apps/flask-material-kit">
<a href="https://appseed.us/product/material-kit/flask/">
<img src="/static/assets/img/logo-ct-dark.png" class="mb-3 footer-logo" alt="main_logo">
</a>
<h6 class="font-weight-bolder mb-4">Material Kit 2</h6>
Expand Down
21 changes: 13 additions & 8 deletions apps/templates/includes/navigation-light.html
Original file line number Diff line number Diff line change
Expand Up @@ -340,14 +340,9 @@ <h6 class="dropdown-header text-dark font-weight-bolder d-flex justify-content-c
</div>
</ul>
</li>
<li class="nav-item ms-lg-auto">
<a class="nav-link nav-link-icon me-2" href="https://appseed.us/apps/flask-apps/flask-material-kit" target="_blank">
<i class="fa fa-download me-1"></i>
<p class="d-inline text-sm z-index-1 font-weight-bold" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Get Sources">Download</p>
</a>
</li>

<li class="nav-item my-auto ms-3 ms-lg-0">
<a href="https://appseed.us/product/flask-material-kit2-pro" target="_blank" class="btn btn-sm bg-gradient-primary mb-0 me-1 mt-2 mt-md-0">Upgrade to Pro</a>
<a href="https://appseed.us/support/" target="_blank" class="btn btn-sm bg-gradient-primary mb-0 me-1 mt-2 mt-md-0">Support</a>
</li>

{% if current_user.is_authenticated %}
Expand All @@ -357,7 +352,17 @@ <h6 class="dropdown-header text-dark font-weight-bolder d-flex justify-content-c
<i class="fa fa-sign-out me-1"></i>
<p class="d-inline text-sm z-index-1 font-weight-bold" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Sign OUT">Logout</p>
</a>
</li>
</li>

{% else %}

<li class="nav-item ms-lg-auto">
<a class="nav-link nav-link-icon me-2" href="https://github.com/app-generator/sample-flask-mongo" target="_blank">
<i class="fa fa-download me-1"></i>
<p class="d-inline text-sm z-index-1 font-weight-bold" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Get Sources">Download</p>
</a>
</li>

{% endif %}

</ul>
Expand Down
22 changes: 14 additions & 8 deletions apps/templates/includes/navigation-transparent.html
Original file line number Diff line number Diff line change
Expand Up @@ -346,24 +346,30 @@ <h6 class="dropdown-header text-dark font-weight-bolder d-flex justify-content-c
</div>
</ul>
</li>
<li class="nav-item ms-lg-auto">
<a class="nav-link nav-link-icon me-2" href="https://appseed.us/apps/flask-apps/flask-material-kit" target="_blank">
<i class="fa fa-download me-1"></i>
<p class="d-inline text-sm z-index-1 font-weight-bold" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Get Sources">Download</p>
</a>
</li>

<li class="nav-item my-auto ms-3 ms-lg-0">
<a href="https://appseed.us/product/flask-material-kit2-pro" target="_blank" class="btn btn-sm bg-white mb-0 me-1 mt-2 mt-md-0">Upgrade to Pro</a>
<a href="https://appseed.us/support/" target="_blank" class="btn btn-sm bg-white mb-0 me-1 mt-2 mt-md-0">Support</a>
</li>

{% if current_user.is_authenticated %}

<li class="nav-item ms-lg-auto">
<a class="nav-link nav-link-icon me-2"
href="{{ url_for('authentication_blueprint.logout') }}">
<i class="fa fa-sign-out me-1"></i>
<p class="d-inline text-sm z-index-1 font-weight-bold" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Sign OUT">Logout</p>
</a>
</li>
</li>

{% else %}

<li class="nav-item ms-lg-auto">
<a class="nav-link nav-link-icon me-2" href="https://github.com/app-generator/sample-flask-mongo" target="_blank">
<i class="fa fa-download me-1"></i>
<p class="d-inline text-sm z-index-1 font-weight-bold" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Get Sources">Download</p>
</a>
</li>

{% endif %}

</ul>
Expand Down
22 changes: 14 additions & 8 deletions apps/templates/includes/navigation.html
Original file line number Diff line number Diff line change
Expand Up @@ -340,24 +340,30 @@ <h6 class="dropdown-header text-dark font-weight-bolder d-flex justify-content-c
</div>
</ul>
</li>
<li class="nav-item ms-lg-auto">
<a class="nav-link nav-link-icon me-2" href="https://appseed.us/apps/flask-apps/flask-material-kit" target="_blank">
<i class="fa fa-download me-1"></i>
<p class="d-inline text-sm z-index-1 font-weight-bold" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Get Sources">Download</p>
</a>
</li>

<li class="nav-item my-auto ms-3 ms-lg-0">
<a href="https://appseed.us/product/flask-material-kit2-pro" target="_blank" class="btn btn-sm bg-gradient-primary mb-0 me-1 mt-2 mt-md-0">Upgrade to Pro</a>
<a href="https://appseed.us/support/" target="_blank" class="btn btn-sm bg-gradient-primary mb-0 me-1 mt-2 mt-md-0">Support</a>
</li>

{% if current_user.is_authenticated %}

<li class="nav-item ms-lg-auto">
<a class="nav-link nav-link-icon me-2"
href="{{ url_for('authentication_blueprint.logout') }}">
<i class="fa fa-sign-out me-1"></i>
<p class="d-inline text-sm z-index-1 font-weight-bold" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Sign OUT">Logout</p>
</a>
</li>
</li>

{% else %}

<li class="nav-item ms-lg-auto">
<a class="nav-link nav-link-icon me-2" href="https://github.com/app-generator/sample-flask-mongo" target="_blank">
<i class="fa fa-download me-1"></i>
<p class="d-inline text-sm z-index-1 font-weight-bold" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Get Sources">Download</p>
</a>
</li>

{% endif %}

</ul>
Expand Down
1 change: 0 additions & 1 deletion run.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
if DEBUG:
app.logger.info('DEBUG = ' + str(DEBUG) )
app.logger.info('Page Compression = ' + 'FALSE' if DEBUG else 'TRUE' )
# app.logger.info('DBMS = ' + app_config.SQLALCHEMY_DATABASE_URI)
app.logger.info('ASSETS_ROOT = ' + app_config.ASSETS_ROOT )

if __name__ == "__main__":
Expand Down

0 comments on commit fabb1eb

Please sign in to comment.