Skip to content

Django version of petroly, this repo currently is the API & backend for the rest of our services

License

Notifications You must be signed in to change notification settings

petroly-initiative/petroly-django

Repository files navigation

Petroly Backend Codebase

GitHub Sponsors Twitter Follow GitHub closed issues

This is Petroly backend for our website Visit us

css3 html5 graphql javascript postgresql postgresql postgresql postgresql

Project Setup

Clone Repository

Note Do not clone this repo directly.

Steps:

  1. Fork this repo.

  2. Open a new terminal/powershell window.

  3. Move to the directory where you want. For example:

  4. Clone the repo that you forked, it'll similar to this:

    git clone https://github.com/YOUR_NAME/petroly.git
  5. Open a new VS Code window, or any other IDE, then drag & drop the cloned folder into VS Code.

Setup python env

We really prefer to set up your python env:

  1. install latest python specified in pyproject.toml file, we advise you to use pyenv manager

  2. install poerty from here

  3. create the virtual environment and install dependencies

    poetry install
  4. activate the virtual environment

    poetry shell

Note If you face an error in installing psycopg2, because it need to build from source, you might need to install PostgresSQL, for MacOS

    brew install postgresql

Check this Q

Run Django

  1. For first time you need to create a SQLite database, by running the command

    python manage.py migrate
  2. Run the server

    python manage.py runserver
  3. Start the telegram bot

    python manage.py startbot

    Note to use the telegram bot setup you need to generate a telegram bot token from BotFather. and use as an environmental variable named TELEGRAM_BOT_TOKEN ( we recommend using secrets vscode extension ) in the backend codebase. After naming your bot, change the bot name In your fork from the frontend in NotificationsModal.jsx in the telegram button component to link it to your bot

  4. Run the async task for periodic checking

    python manage.py qcluster

    Warning This process is stopped by only killing the terminal running it. As the periodic checking is run infintely

The main branch

The main branch is the one that gets deployed into Heroku automaticaly, once any commit detected.

Contribute to This Project

Issues

If you find a bug 🐞 throughout your development or testing process, please do not hesitate to file an issue describing the bug you noticed.

About

Django version of petroly, this repo currently is the API & backend for the rest of our services

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Sponsor this project