Setup project with file structure and flask setup
This commit is contained in:
@@ -1,2 +1,47 @@
|
||||
# acht-damen-tuerme-problem
|
||||
IDPA Arbeit im23a Kristian Anastasia und Jérôme
|
||||
|
||||
```
|
||||
project-root/
|
||||
│
|
||||
├── app/
|
||||
│ ├── __init__.py # Flask App Factory
|
||||
│ ├── config.py # Konfiguration (DB, Secrets, etc.)
|
||||
│ │
|
||||
│ ├── models/ # Datenbankmodelle
|
||||
│ │ ├── __init__.py
|
||||
│ │ ├── user.py
|
||||
│ │ ├── tenant.py
|
||||
│ │ ├── membership.py
|
||||
│ │ └── solver_job.py
|
||||
│ │
|
||||
│ ├── routes/ # API/Endpoints
|
||||
│ │ ├── __init__.py
|
||||
│ │ ├── auth_routes.py
|
||||
│ │ ├── tenant_routes.py
|
||||
│ │ ├── solver_routes.py
|
||||
│ │ └── job_routes.py
|
||||
│ │
|
||||
│ ├── services/ # Businesslogik (Solver etc.)
|
||||
│ │ ├── __init__.py
|
||||
│ │ ├── solver_service.py
|
||||
│ │ └── auth_service.py
|
||||
│ │
|
||||
│ ├── templates/ # HTML (Jinja Templates)
|
||||
│ │ ├── base.html
|
||||
│ │ ├── login.html
|
||||
│ │ ├── dashboard.html
|
||||
│ │ └── solver.html
|
||||
│ │
|
||||
│ ├── static/ # CSS, JS, Bilder
|
||||
│ ├── css/
|
||||
│ ├── js/
|
||||
│ └── img/
|
||||
│
|
||||
├── tests/ # optionale Tests
|
||||
│
|
||||
├── run.py # Startpunkt der Anwendung
|
||||
├── requirements.txt
|
||||
├── .env # DB-Zugangsdaten, Secrets
|
||||
└── README.md
|
||||
```
|
||||
@@ -0,0 +1,18 @@
|
||||
from flask import Flask
|
||||
|
||||
def create_app():
|
||||
app = Flask(__name__)
|
||||
|
||||
# Basic config
|
||||
app.config["SECRET_KEY"] = "dev-secret-key"
|
||||
|
||||
# # ---- Register Blueprints (Routes) ----
|
||||
# from .routes.auth_routes import auth_bp
|
||||
# from .routes.solver_routes import solver_bp
|
||||
from .routes.main_routes import main_bp
|
||||
|
||||
# app.register_blueprint(auth_bp)
|
||||
# app.register_blueprint(solver_bp)
|
||||
app.register_blueprint(main_bp)
|
||||
|
||||
return app
|
||||
@@ -0,0 +1,7 @@
|
||||
from flask import Blueprint, render_template
|
||||
|
||||
main_bp = Blueprint("main", __name__)
|
||||
|
||||
@main_bp.route("/")
|
||||
def home():
|
||||
return render_template("index.html")
|
||||
@@ -0,0 +1,66 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{% block title %}Solver App{% endblock %}</title>
|
||||
|
||||
<!-- CSS -->
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
|
||||
|
||||
{% block head_extra %}{% endblock %}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<!-- Navigation -->
|
||||
<header class="navbar">
|
||||
<div class="container">
|
||||
<h1 class="logo">SolverApp</h1>
|
||||
|
||||
<nav>
|
||||
<a href="/">Home</a>
|
||||
<a href="/solver">Solver</a>
|
||||
|
||||
{% if session.get('user_id') %}
|
||||
<a href="/dashboard">Dashboard</a>
|
||||
<a href="/logout">Logout</a>
|
||||
{% else %}
|
||||
<a href="/login">Login</a>
|
||||
{% endif %}
|
||||
</nav>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- Flash messages -->
|
||||
<main class="container">
|
||||
{% with messages = get_flashed_messages(with_categories=true) %}
|
||||
{% if messages %}
|
||||
<div class="flash-container">
|
||||
{% for category, message in messages %}
|
||||
<div class="flash {{ category }}">
|
||||
{{ message }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
||||
<!-- Page Content -->
|
||||
{% block content %}{% endblock %}
|
||||
</main>
|
||||
|
||||
<!-- Footer -->
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<p>© {{ 2026 }} SolverApp</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<!-- JS -->
|
||||
<script src="{{ url_for('static', filename='js/main.js') }}"></script>
|
||||
{% block scripts %}{% endblock %}
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Binary file not shown.
Reference in New Issue
Block a user