Add the following to your /etc/hosts
file.
127.0.0.1 api.blogapp.com
Run the following commands:
make init
make up
Install Black Connect: https://plugins.jetbrains.com/plugin/14321-blackconnect
blackd
is used to run black as a service
Go to Preferences > Tools > BlackConnect
Check Trigger when saving changed files
Check Trigger on code format
Check Skip string normalization
IMPORTANT!
Connection Settings:
Hostname: localhost
Port: 45484
Install black formatter extension: https://marketplace.visualstudio.com/items?itemName=ms-python.black-formatter
Ensure you set the --skip-string-normalization
argument, to avoid double quotes!
Set black
as the default formatter
Set black
as formatting provider
Set Format on save
to true
http://api.blogapp.com:8080/admin/
Username: admin
Password: 8[D+ko71(%Z7-5(7Pfe7+?_2jd
Username: Richard
Password: helloWorld++
Username: John
Password: helloWorld++
http://api.blogapp.com:8080/graphql/
Whenever you have to install any python dependency, run the following command:
make bash
pip install <your dependency>
pip freeze > requirements.txt
In order to work with .grapqhl
files and code completion features for our tests, we need to update the api schema json file.
Whenever you change the api, run the following command:
make codegen
make bash
pytest
./manage.py dumpdata --natural-foreign --indent 4 --exclude admin --exclude auth --exclude contenttypes --exclude sessions --exclude refresh_token.refreshtoken > blog/fixtures/initial_data.json
Ignore a certain rule for a line
...code... # noqa: W503 (or whatever rule you want to ignore)
Format entire project
black . --skip-string-normalization --line-length 120
Returning a lot of "fake" posts for testing:
posts_list = []
for post in posts:
for i in range(100):
posts_list.append(post)
paginator = Paginator(posts_list, 4)