We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hier ein Vorschlag, wie ich mir so eine saubere Trennung zwischen der HTTP Konfiguration und dem restlichen Code vorstellen könnte (s. #13).
- channels - ... - website - static - templates __init__.py
Die Flask Sachen würde ich dann nur in website/__init__.py machen. So als Beispiel:
website/__init__.py
class Website: ... def register_url(self): self.app.add_url_rule('/', view_func=self.index) self.app.add_url_rule('/api/system', view_func=self.sysinfo_api) def index(self): return render_template('index.html') def sysinfo_api(self): return jsonify(sysinfo.get()) # --> Funktion ausgelagert class ChannelsApi: def __init__(self, wlanthermo): ... self.channels = channels.Channels() # --> vorhandene Klasse ohne Flask Konfiguration def register_api(self): self.app.add_url_rule('/api/colors', view_func=self.channels.get_colors_api) self.app.add_url_rule('/api/channels/<int:module_id>/<int:channel_id>', methods=['POST'], view_func=self.channels.register_channel_api) self.app.add_url_rule('/api/channels/<int:module_id>/<int:channel_id>', view_func=self.channels.get_channels_api) self.app.add_url_rule('/api/channels/<int:module_id>', view_func=self.channels.get_channels_api) ...
Manche Sachen fände ich noch als Modul eleganter (z.B. settings.py anstatt settings/__init__.py), aber das ist Geschmackssache.
settings/__init__.py
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hier ein Vorschlag, wie ich mir so eine saubere Trennung zwischen der HTTP Konfiguration und dem restlichen Code vorstellen könnte (s. #13).
Die Flask Sachen würde ich dann nur in
website/__init__.py
machen. So als Beispiel:Manche Sachen fände ich noch als Modul eleganter (z.B. settings.py anstatt
settings/__init__.py
), aber das ist Geschmackssache.The text was updated successfully, but these errors were encountered: