-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
177 additions
and
444 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,4 @@ python: | |
install: | ||
- pip install -r requirements.txt | ||
script: | ||
- nosetests tests | ||
- true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
Basic Usage | ||
============ | ||
|
||
Lets start with a basic usage example and illustrate the core features Flask Atomic offers. | ||
|
||
Architect Blueprint | ||
++++++++++++++++++++ | ||
|
||
The Architect Blueprint is itself yes, you guessed it a Flask Blueprint. It looks, smells and | ||
sounds just the same as a normal Flask Blueprint but does a little magic for you. | ||
|
||
All that's needed to start is a SQLAlchemy Model to get things started. | ||
|
||
|
||
.. code-block:: python | ||
class SomeModel(db.Model): | ||
id = db.Column(db.Integer, primary_key=True) | ||
name = db.Column(db.Datetime, default=datetime.now()) | ||
username = db.Column(db.String(50)) | ||
alias = db.Column(db.String(50)) | ||
When we have models like this we typically will have a GET route, POST route maybe DELETE and | ||
PUT depending on the application. Typically, these routes will have similar behaviours across | ||
different application: define a route, take some data, create a model, save to database. | ||
|
||
.. code-block:: python | ||
from flask_atomic import Architect | ||
from .models import SomeModel | ||
monitor_blueprint = Architect(SomeModel) | ||
app = Flask(__name__) | ||
app.register_blueprint(monitor_blueprint, url_prefix='example') | ||
if __name__ == '__main__': | ||
app.run() | ||
What has been created? | ||
|
||
1. GET /example (index) | ||
2. GET /example/<resource> (get one) | ||
3. GET /example/<resource>/<field> (get one and fetch field) | ||
4. POST /example (accepts fields and creates entries in database) | ||
5. | ||
|
||
|
||
Curl your API and see it in action: | ||
|
||
localhost:5000/access |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Flask Atomic Recipes | ||
===================== | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from .ext import FlaskJSON | ||
from .builder import Architect | ||
from .builder.architect import Architect | ||
|
||
__all__ = ['Architect', 'FlaskJSON'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
from .multi import MultiModelBuilder | ||
from flask_atomic.architect import Architect | ||
from flask_atomic.builder.architect import Architect | ||
from .core import BuilderCore | ||
|
||
__all__ = [Architect, MultiModelBuilder, BuilderCore] |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.