Flask XinIDEA
Some Flask custom extension
- redprint
- reflectdb
Install
pip install --index-url https://test.pypi.org/simple/ --no-deps -U flask-xinidea
Redprint
- Usage
from flask import Flask
from flask import Blueprint
from flask_xinidea.redprint import Redprint
app = Flask(__name__)
bp = Blueprint('test', __name__)
test = Redprint(bp, url_prefix='/test')
@test.route('')
def index():
return 'this is a test'
app.register_blueprint(bp)
if __name__ == "__main__":
app.run()
- Test
flask run
flask routes
curl http://127.0.0.1:5000/test
ReflectDB
- Usage
from flask import Flask
from flask import Blueprint
from flask_xinidea.redprint import Redprint
from flask_xinidea.reflectdb import ReflectDB
settings = dict(
SQLALCHEMY_TRACK_MODIFICATIONS=False,
SQLALCHEMY_DATABASE_URI='mysql+cymysql://localhost/temp',
SQLALCHEMY_BINDS={
'test': 'mysql+cymysql://localhost/test'
}
)
app = Flask(__name__)
app.config.from_mapping(settings)
bp = Blueprint('test', __name__)
test = Redprint(bp, url_prefix='/test')
# the test is the SQLALCHEMY_BINDS key or
# a SQLALCHEMY_DATABASE_URI like 'mysql://localhost/temp'
testdb = ReflectDB('test', app)
# testdb = ReflectDB('mysql://localhost/temp')
User = testdb.get_table('users')
@test.route('')
def index():
return 'this is a test'
@test.route('/users/<int:id>')
def get_user(id):
user = User.query.get(id)
if user:
return user.name
else:
return 'Not exists'
app.register_blueprint(bp)
if __name__ == "__main__":
app.run()
- Test
flask routes
flask run
curl http://127.0.0.1:5000/test/users/user:id
2019-11-29 by phiix
Metadata
Release files for flask-xinidea 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| flask-xinidea-0.0.4.tar.gz | 2.2 kB | Without provenance | Details for flask-xinidea-0.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| flask_xinidea-0.0.4-py3-none-any.whl | Python 3 | none | any | Details for flask_xinidea-0.0.4-py3-none-any.whl |
Total release size: 6.1 kB
Release files / flask-xinidea-0.0.4.tar.gz
| Download URL | flask-xinidea-0.0.4.tar.gz |
|---|---|
| Size | 2.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4f407446dbf9ea0cc4c4780bf44fb026ca1d5a30a2a1dd6ac5f4a587ce64afae
|
|
BLAKE2b-256 checksum How to use checksums |
b6bbce6c3ee214a31d4e6ab00bd29c32a3a5d5fa89a7675bf0c456771e41729f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.7.5
|
Release files / flask_xinidea-0.0.4-py3-none-any.whl
| Download URL | flask_xinidea-0.0.4-py3-none-any.whl |
|---|---|
| Size | 3.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
797154d5573a60a72f10f1de09c1dd5f91473fbad83238822f8e4a7cb2999828
|
|
BLAKE2b-256 checksum How to use checksums |
8960a935cbc19578e263439b1bec7ddd5ba858a0d32981b03c91e6819587a1bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.7.5
|
Security for flask-xinidea 0.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.