Coder Social home page Coder Social logo

caligula1022 / ccvgd-backend Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ulsdevteam/ccvgd-backend

0.0 0.0 0.0 2.8 MB

Contemporary Chinese Village Gazetteer Data backend application

License: MIT License

Python 99.87% Dockerfile 0.13%

ccvgd-backend's Introduction

Configuration expectations

Mysql is database

  • MAX_CONTENT_LENGTH = 310241924

Database connection field

The username is default root and password is 123456

As we have Chinese in the database and coding, so set

  • JSON_AS_ASCII= False

Opening DEBUG mode

class DevlopConfig(Config):
  DEBUG = True

Running command

python3 app.py runserver -p port_num

Deploy environment

The working dir is

- ccvgd-backend
  - app.py 
  - ...
- Dockerfile

So in docker file I create

FROM python:3.6


ADD . /ccvgd-backend
WORKDIR /ccvgd-backend
ENV PYTHONPATH=/ccvgd-backend

# Install any needed packages specified in requirements.txt
COPY requirements.txt /ccvgd-backend
RUN pip3 install -r requirements.txt

# Run app.py when the container launches
COPY app.py /app
CMD python3 app.py runserver -p 5050

Then run

docker build -t ccvgd_backend:latest .

The result is: run docker images

REPOSITORY TAG IMAGE ID CREATED SIZE
ccvgd-backend latest xxx 49 seconds ago 1.85GB

I tried this and it worked on my laptop, so if you want to change the port and path, please go ahead!

Then exec this docker image to a container

docker run --name ccvgd -d ccvgd_backend -p 5050:5050 The port should be mapped from inside 5050 to outside 5050, and the name you can change.

If you want to see details inside this docker file, just use docker exec -it ccvgd /bin/bash to get into docker container.

Docker file and deploy our app through and I add the docker file composed flask and mysql into Dockerfile.

This compose function I write in docker-compose.yml

version: "2.2"
services:
  mysql:
    image: mysql:5.7
    ports:
      - "3306:3306"
    environment:
      - MYSQL_ROOT_PASSWORD=123456
    volumes:
      - ./db:/docker-entrypoint-initdb.d/:ro
  ccvg:
    build: ./
    ports:
      - "5000:5000"
    depends_on:
      - mysql
    restart: always

The build path of this ccvg I set build: ./ so the absolute path of this docker-compose.yml is "./ccvgd-backend/docker-compose.yml"

And the version here I set 2.2.

Use command docker-compose up to compose.

ccvgd-backend's People

Contributors

joydajunspacecraft avatar xiaoxin-he avatar ctgraham avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.