Skip to content

Commit

Permalink
Arquitetura do Projeto e dicas de estrutura e qualidade 🐹
Browse files Browse the repository at this point in the history
  • Loading branch information
rochacbruno committed Sep 29, 2017
1 parent c3c26f2 commit 6bcfaf9
Show file tree
Hide file tree
Showing 15 changed files with 92 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.egg-info*
*.egg*
*.build*
build/
*__pycache__*
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.PHONY: clean pep8 test install

clean: ## remove Python file artifacts
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +

pep8: ## check style with flake8
flake8 cms tests

test: pep8 ## run tests quickly with the default Python
py.test -v

install: clean test ## install the package to the active Python's site-packages
python setup.py develop
24 changes: 23 additions & 1 deletion cms/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,23 @@
Neste diretório o projeto de CMS será desenvolvido, mão na massa! é com você
# 1) Arquitetura do Projeto e dicas de estrutura e qualidade

Instalado através do `setup.py` com `python setup.py develop` e irá prover
a ferramenta de linha de comando `cms` a partir da qual iremos rodar
`cms runserver` e `cms shell` e `cms adduser`

A estrutura do projeto será:

```bash
Makefile # Utilidades `install`, `clean`, `pep8` e `test`
setup.py # Instalador do projeto `python setup.py develop`
tests/ # Testes com py.test
cms/ # module root
├── app/ # Application Factory (Flask app será iniciada aqui)
├── config/ # Configuration Factory (Load de configurações)
├── ext/ # Extensões (Blueprints) do app
├── static/ # Arquivos estáticos (.css, .js, .images)
├── templates/ # Templates Jinja2
├── cli.py # Ferramenta de linha de comando `cms --help`
├── __init__.py # Python module init
├── README.md # Este arquivo
└── settings.yml # Configurações que serão carregadas
```
Empty file added cms/__init__.py
Empty file.
Empty file added cms/app/__init__.py
Empty file.
Empty file added cms/cli.py
Empty file.
Empty file added cms/config/__init__.py
Empty file.
Empty file added cms/ext/__init__.py
Empty file.
Empty file added cms/settings.yml
Empty file.
Empty file added cms/static/README.md
Empty file.
Empty file added cms/templates/README.md
Empty file.
File renamed without changes.
34 changes: 34 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
from setuptools import setup

requirements = [
'flask',
'import_string',
'pymongo',
'tinymongo',
'tinydb_serialization',
'dynaconf',
'awesome_slugify',
'mistune',
'flask_simplelogin',
'flask_admin',
'flask_wtf',
]


setup(
name='cms',
version='0.0.1',
description="A simple CMS in Flask",
author="Bruno Rocha",
author_email='[email protected]',
url='https://github.com/cursodepythonoficial/',
packages=['cms'],
package_dir={'cms': 'cms'},
entry_points={
'console_scripts': [
'cms=cms.cli:main'
]
},
include_package_data=True,
install_requires=requirements
)
8 changes: 8 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import pytest


@pytest.fixture
def app():
"""Flask Pytest uses it"""
# return create_app()
return 'app'
6 changes: 6 additions & 0 deletions tests/test_basic.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import pytest


@pytest.mark.skip
def test_app_secret_is_set(app):
assert 'SECRET_KEY' in app.config

0 comments on commit 6bcfaf9

Please sign in to comment.