-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Atualização do README.md #71
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,40 @@ | ||
FlaskSeguro | ||
========== | ||
Exemplo do python-pagseguro utilizando Flask. | ||
Exemplo de integração do python-pagseguro utilizando Flask. | ||
|
||
Instalação | ||
Instalando a virtualenv | ||
========== | ||
|
||
```bash | ||
virtualenv env | ||
pip install -U pip | ||
pip install virtualenv | ||
``` | ||
Caso tenha alguma dúvida sobre a virtualenv ou ocorra algum erro no momento da instalação, verifique a documentação [clicando aqui](https://virtualenv.pypa.io/en/stable/installation/). | ||
|
||
Download e Instalação | ||
========== | ||
Testado com o Python 3.6 >. | ||
|
||
```bash | ||
virtualenv -p python3 env | ||
source env/bin/activate | ||
git clone https://github.com/rochacbruno/python-pagseguro.git | ||
cd python-pagseguro/examples/flask/ | ||
pip install -r requirements.txt | ||
./run.py | ||
``` | ||
|
||
Execução | ||
========== | ||
Com o terminal aberto e setado na pasta _python-pagseguro/examples/flask_, execute o seguinte comando: | ||
|
||
```bash | ||
env FLASK_APP=run.py flask run | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FLASK_APP é uma variável de ambiente, utilize o Referência: https://flask.palletsprojects.com/en/1.0.x/cli/ |
||
``` | ||
|
||
Configuração | ||
========== | ||
Altere o settings.cfg, ele possui as seguintes configurações por padrão: | ||
Altere o _settings.cfg_, ele possui as seguintes configurações por padrão: | ||
|
||
``` | ||
EXTRA_AMOUNT = 12.12 | ||
REDIRECT_URL = "http://meusite.com/obrigado" | ||
|
@@ -26,11 +44,24 @@ TOKEN = "ABCDEFGHIJKLMNO" | |
SECRET_KEY = "s3cr3t" | ||
``` | ||
|
||
Caso as alterações não sejam feitas, o PagSeguro te notificará de erro retornando a seguinte mensagem _Código de checkout inválido_: | ||
|
||
 | ||
|
||
|
||
|
||
Testes | ||
========== | ||
Para executar alguns testes e verificar se está tudo certo com a aplicação, execute: | ||
|
||
```bash | ||
./tests.py | ||
``` | ||
|
||
Caso retorne algum erro, dê permissão ao arquivo e reexecute o comando acima. Assim: | ||
|
||
```bash | ||
chmod +x tests.py | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Eu ainda estou em dúvida sobre isso, mas eu acredito que não precisa da permissão para rodar os testes. Caso sinta dificuldade de utilizar o Makefile rode manualmente assim: O que acha @mazulo e @rochacbruno ? |
||
./tests.py | ||
``` | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eu acho que você poderia utilizar o pipenv ou poetry ao invés de criar o virtualenv na mão, apesar destas libs utilizar por debaixo dos panos o virtualenv, ganhamos algumas features como versionamento, lock file e etc...