Skip to content

ttbkk-univ/ttbkk-server

Repository files navigation

tteokbokki-map-server

Tteokbokki Map API Server



For ttbkk-web contributors

Here is always usable develop stage ttbkk-server for ttbkk-web contributor.

You don't need to run this server for your client development.
Just fill text like below in your .env file in ttbkk-web project.

REACT_APP_API_HOST=https://dev-api.ttbkk.com

How to setup

1. Install python environment

There are multiple ways to get python environments.

  1. pyenv
  2. venv
  3. pipenv

2. Clone and install requirements

git clone https://github.com/siner308/ttbkk-server
cd ttbkk-server
pip install -r requirements.txt

3. Set env

  1. Copy env.sample.py to env.py
    cp env.sample.py env.py
  2. Set env
    • Fill environments in your env.py

4. Launch for server

Before launch, you need to setup mysql database.

python3 manage.py migrate
python3 manage.py runserver 0.0.0.0:8000

Additional setup for crawler

1. Download chromedriver

  1. Download chromedriver that suit with your os and chrome version.
  2. Locate chromedriver to your project root.
    • For example: ./ttbkk-server/chromedriver
  3. Fix your env.py
    # env.py
    CHROMEDRIVER_PATH = './chromedriver'

2. Set API Key

  1. Set Google API Key
  2. Set Kakao API Key
  3. Fix your env.py
    GOOGLE_MAP_KEY = ''
    KAKAO_API_KEY = ''

3. Launch for crawler

  1. Setup database

    Before launch, you need to setup mysql database.

  2. Select targets you want to scrap.

    # src.crawlers.main.py:
    
    def run():
        crawlers = get_crawlers([
            # FranchiseType.SINJEON,
            # FranchiseType.GAMTAN,
            # FranchiseType.YUPDDUK,
            # FranchiseType.BAEDDUCK,
            # FranchiseType.MYUNGRANG,
            # FranchiseType.YOUNGDABANG,
            # FranchiseType.SINCHAM,
            # FranchiseType.SINBUL,
            # FranchiseType.EUNGDDUK,
            # FranchiseType.JAWSFOOD,
            # FranchiseType.TTEOKCHAM,
            # FranchiseType.SAMCHEOP,
            # FranchiseType.DALDDUK,
            # FranchiseType.DOOKKI
            FranchiseType.KANG
        ])
        for crawler in crawlers:
            crawler.run()
  3. Move into django shell

    # in bash
    python3 manage.py migrate
    python3 manage.py shell
  4. Run script

    # in python shell
    >>> from src.crawlers.main import run
    >>> run()

Languages