Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
[![Documentation Status](https://readthedocs.org/projects/hobbit-core/badge/?version=latest)](https://hobbit-core.readthedocs.io/en/latest/?badge=latest)
[![](https://img.shields.io/:license-mit-blue.svg?style=flat-square)](https://hobbit-core.mit-license.org)

A flask project generator.
A flask project generator. Based on Flask + SQLAlchemy + marshmallow + webargs.

[Readmedocs](https://hobbit-core.readthedocs.io/en/latest/)
[https://hobbit-core.readthedocs.io/en/latest/](https://hobbit-core.readthedocs.io/en/latest/)
71 changes: 71 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
Hobbit-core's API Documentation
===============================

hobbit_core.hobbit
------------------

hobbit - A flask project generator.

.. autofunction:: hobbit_core.hobbit.bootstrap.startproject

hobbit_core.flask_hobbit
------------------------

A flask extension that take care of base utils.

.. automodule:: hobbit_core.flask_hobbit
:members:
:undoc-members:

db
^^

.. automodule:: hobbit_core.flask_hobbit.db
:members:
:undoc-members:
:exclude-members: SurrogatePK

.. autoclass:: SurrogatePK
:members: __repr__

pagination
^^^^^^^^^^

.. automodule:: hobbit_core.flask_hobbit.pagination
:members:
:undoc-members:

schemas
^^^^^^^

.. automodule:: hobbit_core.flask_hobbit.schemas
:members:
:undoc-members:
:exclude-members: PagedSchema

.. autoclass:: PagedSchema
:members:

utils
^^^^^

.. automodule:: hobbit_core.flask_hobbit.utils
:members:
:undoc-members:


response
^^^^^^^^

.. automodule:: hobbit_core.flask_hobbit.response
:members:
:undoc-members:

err_handler
^^^^^^^^^^^

.. automodule:: hobbit_core.flask_hobbit.err_handler
:members:



6 changes: 4 additions & 2 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
Change history
==============

1.2.0 (unreleased)
1.2.0 (2018-10-10)

* Gitlab CI/CD support.
* Some useful cmds.
* Add secure_filename util.
* Enhance deploy, can deploy to multiple servers.
* Add --port option for startproject cmd.

1.1.0 (2018-09-29)
******************
Expand Down
115 changes: 55 additions & 60 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
Welcome to hobbit-core's documentation!
=======================================
Hobbit-core's documentation
===========================

`changelog <changelog.html>`_ //
`github <https://github.com/TTWShell/hobbit-core>`_ //
`pypi <https://pypi.org/project/hobbit-core/>`_ //
`issues <https://github.com/TTWShell/hobbit-core/issues>`_
`issues <https://github.com/TTWShell/hobbit-core/issues>`_ //
`API doc <api.html>`_ //
`中文文档 <index_cn.html>`_

A flask project generator. Based on Flask + SQLAlchemy + marshmallow + webargs.

A hobbit app contains RESTful API, unit test, gitlab-ci/cd、docker compose etc.

**Why do we need this project?** Answer is `Convention over configuration. <https://en.wikipedia.org/wiki/Convention_over_configuration>`_

Expand All @@ -18,7 +24,7 @@ Get it right now::

Create your flask project::

hobbit --echo startproject -n demo -d . --example
hobbit --echo startproject -n demo -d . --example -p 5000

Run flask app::

Expand Down Expand Up @@ -46,6 +52,7 @@ Project Tree
If not skip example(Please see --example/--no-example options), you can get project tree like this::

.
├── Dockerfile
├── app
│   ├── __init__.py
│   ├── configs
Expand All @@ -69,13 +76,21 @@ If not skip example(Please see --example/--no-example options), you can get proj
│   └── views
│   ├── __init__.py
│   └── example.py
├── deploy.sh
├── docker-compose.yml
├── docs
├── logs
├── requirements.txt
└── tests
├── __init__.py
├── conftest.py
└── test_example.py

Dockerfile
----------

Build image for run web server. For more information about dockerfile, please visit : `Dockerfile reference <https://docs.docker.com/engine/reference/builder/#usage>`_.

app
---

Expand All @@ -86,86 +101,65 @@ configs

In a hobbit app, we auto load config by FLASK_ENV. If FLASK_ENV=production, used ``configs/production.py`` file.

exts
core
^^^^

`Why use exts.py to instance extension? <https://stackoverflow.com/questions/42909816/can-i-avoid-circular-imports-in-flask-and-sqlalchemy/51739367#51739367>`_

All complicated function, base class etc.

API
===

hobbit_core.hobbit
------------------

hobbit - A flask project generator.

.. autofunction:: hobbit_core.hobbit.bootstrap.startproject
exts.py
^^^^^^^

hobbit_core.flask_hobbit
------------------------
To avoid circular imports in Flask and flask extention, exts.py used. `Why use exts.py to instance extension? <https://stackoverflow.com/questions/42909816/can-i-avoid-circular-imports-in-flask-and-sqlalchemy/51739367#51739367>`_

A flask extension that take care of base utils.
models
^^^^^^

.. automodule:: hobbit_core.flask_hobbit
:members:
:undoc-members:
Create your models here.

db
^^
run.py
^^^^^^

.. automodule:: hobbit_core.flask_hobbit.db
:members:
:undoc-members:
:exclude-members: SurrogatePK
schemas
^^^^^^^

.. autoclass:: SurrogatePK
:members: __repr__
Create your marshmallow scheams here.

pagination
^^^^^^^^^^
utils
^^^^^

.. automodule:: hobbit_core.flask_hobbit.pagination
:members:
:undoc-members:
All common utils here.

schemas
^^^^^^^
views
^^^^^

.. automodule:: hobbit_core.flask_hobbit.schemas
:members:
:undoc-members:
:exclude-members: PagedSchema
Create your views here.

.. autoclass:: PagedSchema
:members:
deploy.sh
---------

utils
^^^^^
A script for deploy.

.. automodule:: hobbit_core.flask_hobbit.utils
:members:
:undoc-members:
docker-compose.yml
^^^^^^^^^^^^^^^^^^

Base docker compose file. Run app::

response
^^^^^^^^
docker-compose up

.. automodule:: hobbit_core.flask_hobbit.response
:members:
:undoc-members:
docs
----

err_handler
^^^^^^^^^^^
API doc etc.

.. automodule:: hobbit_core.flask_hobbit.err_handler
:members:
logs
----

All logs for app, nginx etc.

Indices and tables
==================
tests
-----

* :ref:`search`
Create your tests here. Recommended use `pytest <https://docs.pytest.org/en/latest/>`_.


Others
Expand All @@ -175,3 +169,4 @@ Others
:maxdepth: 2

changelog
api
Loading