The RESTful API for farmerz. Also includes a sleek admin interface.
The version numbers are listed as a reference. As long as the major version is the same, everything should be fine. See semanic versioning.
If you are reading this, you already have a copy of the repository. All commands are issued from the root of the repository, unless specified otherwise. Lines starting with #
are comments and are not to be executed.
npm install
npm run build
You can skip/modify this section if you understand how virtual environments work and why they are needed.
python -m venv virtual
source virtual/bin/activate.ps1
pip install -r requirements.txt
Use this if you want to support other languages.
GNU gettext utilities are a requirement for this section! See django docs for more info.
python manage.py compilemessages -l ne
python manage.py migrate
If you want to create a testing database, you can use the populatetestdb
command. Don't do this in production!
python manage.py populatetestdb
python manage.py runserver
You can run tests with
python manage.py test --pattern="tests_*.py"
The Browsable API (accessible through /api
), and this document are the primary sources of documentation.
The API is extensively documented. The documentation is displayed in the browsable API (in development builds).
The code is organized into several (mostly self-contained) apps.
core
: Basic site related models (Site/SiteSettings)authentication
: Token based authentication and user model.store
: Core stuff related to store: customer
, items
, order
, category
, purchase
etc.administrator
: The admin interface and relevant models.emails
: Mechanism to send emails on eventsThe email/password information is displayed when you populate the test database.
You can also refer to administrator/management/populatetestdb.py
for any other information.
Make sure graphviz is installed
python manage.py graph_models -a -g -o static/shared/models.png
Refer to the documentation regarding deployment from django. Basic queries should be answered there.
Copy the .env.template
file into .env
cp .env.template .env
export DJANGO_SETTINGS_MODULE = 'farmerz_api.production'
generate_secret_key
python manage.py generate_secret_key
.env
fileNote: You can provide the environment variables without using the .env file. But you have to make sure that .env file doesn't override your values! The file is sourced by manage.py
. Make sure it is empty, if rolling your own solution.
This project uses precommit. Make sure to install the git hooks. Additionally, make sure tests pass before pushing.
Refer to the developer guide for instructions to set up your environment.