dann254 / mavuno-api

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MAVUNO - [API]

Mavuno is a product that allows collection of data about farmers, farms and their harvests.

Relevant Links

TODO

  • Make detailed docs
  • add flagging of inconsistent data
  • cascade deletion to Uploaded image files
  • more tests
  • fix static files on heroku affecting images and docfiles

Relevant information

  • ** new supervisor ** can only be created through the console with the following command.
python manage.py createsuperuser --email email@example.com
  • Test user ** email: ** email@example.com, ** password: ** password1

How to set up

  • Make sure you have python3 installed.
  • You should have postgreSQL or other database management engines installed in your development environment.
  • Install virtualenv and virtualenvwrapper or use suitable alternatives to create a virtual environment.
  • using virtualenvwrapper
$ mkvirtualenv mavuno
$ workon mavuno
  • Clone this repository:
git clone git@github.com:dann254/mavuno-api.git
  • switch to the project folder:
cd mavuno-api
  • install requirements:
pip install -r requirements.txt
  • Create a postgreSQL database:
createdb mavuno_db

- follow appropriate tutorials for other DB managers

  • Create a .env file in the project the directory (database-api/mavuno/) with the following format.
  export DB_URL="postgis://USER:PASSWORD@HOST:PORT/mavuno_db"
  export CURRENT_ENV="development"
  export SECRET_KEY="your-secret-key"
  • instructions for setting up DB_URL on other recomended DB managers are found Here.

  • Run migrations from the project root directory to update the database

python manage.py migrate
  • To start the app, run:
python manage.py runserver
  • All set up, you can now use the url http://127.0.0.1:8000/ to access the app from your development server. 🤗

  • The API docs and relevant endpoints will be availabe in GIU by accessing the URL on a browser.

  • running tests

    After setting up your development environment

    • run tests using the following command:
    ./manage.py test
  • Django SuperUser

    After setting up your development environment

    • add a super user using the following command:
    python manage.py createsuperuser --email email@example.com

About


Languages

Language:Python 100.0%