Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alegarsan11 committed May 27, 2024
1 parent bbc56ca commit cb95690
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ sudo systemctl restart apache2

# Iniciar el parser de nftables
cd nftables-parser
sudo hug -f main.py
sudo hug -f main.py
32 changes: 32 additions & 0 deletions nftables-frontend/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,38 @@ def internal_error(e):
def favicon():
return app.send_static_file('favicon.ico')

def create_app():
app = Flask(__name__)
app.register_blueprint(visualization_bp)
app.register_blueprint(creation_bp)
dir_path = os.path.dirname(os.path.realpath(__file__))
app.config['SECRET_KEY'] = 'hfds732klejds90ahg'
app.config['SQLALCHEMY_DATABASE_URI'] = f'sqlite:///{dir_path}/instance/nftables.db'
app.config['SESSION_COOKIE_SAMESITE'] = 'Strict'
app.config['SESSION_COOKIE_SECURE'] = True
login_manager.init_app(app)
db.init_app(app)

with app.app_context():
db.create_all()
create_default_user()

migrate = Migrate(app, db)
Bootstrap(app)

@app.errorhandler(404)
def page_not_found(e):
return render_template('error.html', message='Page not found'), 404

@app.errorhandler(500)
def internal_error(e):
return render_template('error.html', message="Internal server error"), 500

@app.route('/favicon.ico')
def favicon():
return app.send_static_file('favicon.ico')

return app

if __name__ == '__main__':
app.run(debug=False)

0 comments on commit cb95690

Please sign in to comment.