Skip to content

fadhilkidd/skye

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Skye bot

Designed to utilitze daily tasks for LINE users.

Table of Contents:

Prerequisites

  • Python v3.8.1
  • Pip v19.3.1
  • Ngrok v2.3.35
  • Psql v10.12 - Optional if you will use SQLITE3 instead

Setup

Ensure you have cloned/pulled the repository to your local. Open terminal from the root repository and run all these commands at once for setup.

  1. Create virtual local python environment
    python -m venv env
  2. Activate local environment, you can find a away to do that from this section
  3. Install all dependencies.
    pip install -r requirements.txt
  4. Create .env in the root repository and add necessary environment variables as follow:
    Variable Optional Value Default
    LINE_CHANNEL_SECRET No The host of database server
    LINE_CHANNEL_TOKEN No The port that used by the host
    DEBUG No Either 1 or 0 1
    ALLOWED_HOSTS Yes List of allowed hosts and separated by comma *
    DBMS Yes Either SQLITE3 or POSTGRESQL SQLITE3
    DATABASE_NAME Yes Targeted database, ensure you have created on your DBMS
    DATABASE_USER Yes User's name to access the database
    DATABASE_PASSWORD Yes User's password to access the database
    DATABASE_HOST Yes The host of database server
    DATABASE_PORT Yes The port that used by the host

Activate and Deactivate Environment

This section will help you to activate and deacivate local environment through CLI.

  • Activate Environment

    • Windows
      env\Scripts\activate
    • Unix
      source env/bin/activate
  • Deactivate Environment

    And if you need to close it, then run as easy as run terminated signal:

    • Windows/Unix
      [CTRL + C]

    or you can close it in gracefully way:

    • Windows/Unix
      deactivate

Usage

  • Run application

    Before you follow these instructions, ensure that you already activated local environment as follow as this section. After that, here are things you need to do.
    1. Run ngrok to make public url
      ngrok http localhost:8000
    2. Copy the public url the one with https and put it as webhook URL in LINE Bot configuration.
    3. Run the application
      python manage.py runserver
    4. Exit by triggering a default terminate signal if you already done
      [CTRL + C]
  • Migrate a model

    Assume you already started the application. Here are available commands you could use on this project:
    • Make migrations if you edit/create a model
      python manage.py makemigrations
    • Migrate the model changes you made in database
      python manage.py migrate
  • Create a superuser

    Ensure you already started the application before do these steps:
    python manage.py createsuperuser

Maintainers

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 99.8%
  • Shell 0.2%