install flask and flasgger using:
pip install flask
pip install flasgger
then run flask with:
export FLASK_APP=api
export FLASK_ENV=development
flask run
install flask and flasgger using:
pip install flask
pip install flasgger
then run flask with:
export FLASK_APP=api
export FLASK_ENV=development
flask run
| @contextmanager | |
| def get_app_context(conf=None): | |
| """get an app context! | |
| we will receive the name of the application and then try to build out the | |
| applicaton and return it. the important thing with this function is that we | |
| will return the application context not the actual application object. | |
| this is usefull for modules and functions that need the application context | |
| to be able to do what they would need to do. |
| CKEDITOR.editorConfig = function( config ) { | |
| config.toolbarGroups = [ | |
| { name: 'document', groups: [ 'mode', 'document', 'doctools' ] }, | |
| { name: 'editing', groups: [ 'find', 'selection', 'spellchecker', 'editing' ] }, | |
| { name: 'forms', groups: [ 'forms' ] }, | |
| { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] }, | |
| { name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi', 'paragraph' ] }, | |
| { name: 'links', groups: [ 'links' ] }, | |
| { name: 'styles', groups: [ 'styles' ] }, | |
| { name: 'insert', groups: [ 'insert' ] }, |
| #!/bin/bash | |
| # bash generate random alphanumeric string | |
| # | |
| # bash generate random 32 character alphanumeric string (upper and lowercase) and | |
| NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) | |
| # bash generate random 32 character alphanumeric string (lowercase only) | |
| cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1 |
| from contextlib import contextmanager | |
| from sqlalchemy import Column, ForeignKey, Integer, String, Boolean, DateTime, Text | |
| from sqlalchemy.ext.declarative import declarative_base | |
| from sqlalchemy.orm import relationship | |
| from sqlalchemy import create_engine | |
| from sqlalchemy.orm import sessionmaker, Session | |
| Base = declarative_base() |
| import sys | |
| import logging | |
| # handlers = { | |
| # 'stream': logging.StreamHandler(sys.stdout), | |
| # 'errstream': logging.StreamHandler(sys.stderr), | |
| # 'file': logging.FileHandler, | |
| # 'null': logging.NullHandler, | |
| # 'rotatefile': logging.handlers.RotatingFileHandler, |
| """ the problem is, we want to be able to change session life time of a flask app, | |
| on the fly, without restarting the app. the reason for this is, that the app was | |
| being used as a UI for a networking device, customers were able to use our app | |
| instead of using a terminal to config the device. so, we thought it would be a | |
| better UX thing to not restart the application, on session time change. | |
| i was tasked to solve the problem, and this is how i approached it: | |
| i checked the source code of flask to see how it works, and set the session life | |
| time. |
I hereby claim:
To claim this, I am signing this object:
| <html><body><h1>It works!</h1> | |
| <p>This is the default web page for this server.</p> | |
| <p>The web server software is running but no content has been added, yet.</p> | |
| </body></html> |
| (custom-set-variables | |
| ;; custom-set-variables was added by Custom. | |
| ;; If you edit it by hand, you could mess it up, so be careful. | |
| ;; Your init file should contain only one such instance. | |
| ;; If there is more than one, they won't work right. | |
| '(cua-mode t nil (cua-base)) | |
| '(custom-enabled-themes (quote (deeper-blue)))) | |
| '(tool-bar-mode nil) | |
| (custom-set-faces | |
| ;; custom-set-faces was added by Custom. |