Skip to content

Commit

Permalink
Project bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
mekanix committed Mar 3, 2020
1 parent b0b6e4a commit e1f8cd5
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 10 deletions.
6 changes: 1 addition & 5 deletions bin/freenit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,15 @@ if [ -z "${NAME}" ]; then
fi


MODULES="schemas"
PROJECT_ROOT=`python${PY_VERSION} -c 'import os; import freenit; print(os.path.dirname(os.path.abspath(freenit.__file__)))'`


mkdir ${NAME}
for module in ${MODULES}; do
mkdir -p ${NAME}/${module}
touch ${NAME}/${module}/__init__.py
done
touch ${NAME}/__init__.py
echo 'freenit' >requirements.txt
cp -r ${PROJECT_ROOT}/project/* .
mv api ${NAME}
mv models ${NAME}
mv schemas ${NAME}
echo "app_name=\"${NAME}\" # noqa: E225" >name.py
echo "ipdb" >requirements_dev.txt
Empty file.
5 changes: 5 additions & 0 deletions freenit/project/schemas/role.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from freenit.schemas.role import RoleSchema as BaseRoleSchema


class RoleSchema(BaseRoleSchema):
pass
5 changes: 5 additions & 0 deletions freenit/project/schemas/user.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from freenit.schemas.user import BaseUserSchema


class UserSchema(BaseUserSchema):
pass
5 changes: 1 addition & 4 deletions freenit/project/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
api = import_module(f'{app_name}.api')
config_name = os.getenv('FLASK_ENV') or 'default'
config = configs[config_name]
schemas = {
'user': f'{app_name}.schemas.user',
}
app = create_app(config, schemas=schemas)
app = create_app(config)
api.create_api(app)
hostname = socket.gethostname()
port = os.environ.get('FLASK_PORT', 5000)
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name='freenit',
version='0.0.25',
version='0.0.26',
description='REST API framework based on Flask-Smorest',
long_description=README,
long_description_content_type='text/markdown',
Expand Down Expand Up @@ -58,6 +58,7 @@
'project/bin/*',
'project/api/*',
'project/models/*',
'project/schemas/*',
]
},
scripts=['bin/freenit.sh'],
Expand Down

0 comments on commit e1f8cd5

Please sign in to comment.