add requirements pillow create dockerfile and docker compose fix privkey file path add flask admin for developments.pull/5/head
parent
923df90014
commit
e886e4e95c
@ -0,0 +1,17 @@ |
||||
FROM python:3.9.1-buster |
||||
WORKDIR /code |
||||
ENV FLASK_APP=main.py |
||||
ENV FLASK_RUN_HOST=0.0.0.0 |
||||
RUN apt install gcc |
||||
|
||||
RUN apt-get update && apt-get install -y \ |
||||
python-dev python-pip python-setuptools \ |
||||
libffi-dev libxml2-dev libxslt1-dev \ |
||||
libtiff-dev libjpeg-dev zlib1g-dev \ |
||||
liblcms2-dev libwebp-dev python-tk |
||||
|
||||
COPY requirements.txt requirements.txt |
||||
RUN pip install -r requirements.txt |
||||
EXPOSE 5000 |
||||
COPY . . |
||||
CMD ["flask", "run"] |
@ -0,0 +1,29 @@ |
||||
version: "3.3" |
||||
services: |
||||
mongo: |
||||
image: mongo |
||||
restart: always |
||||
environment: |
||||
MONGO_INITDB_ROOT_USERNAME: xcoder |
||||
MONGO_INITDB_ROOT_PASSWORD: 4dun4710 |
||||
volumes: |
||||
- ./mongo_data_dir/:/data/db/ |
||||
mongo-express: |
||||
image: mongo-express |
||||
restart: always |
||||
ports: |
||||
- 8081:8081 |
||||
environment: |
||||
ME_CONFIG_MONGODB_ADMINUSERNAME: xcoder |
||||
ME_CONFIG_MONGODB_ADMINPASSWORD: 4dun4710 |
||||
ME_CONFIG_OPTIONS_EDITORTHEME: ambiance |
||||
ME_CONFIG_BASICAUTH_USERNAME: xcoder |
||||
ME_CONFIG_BASICAUTH_PASSWORD: 4dun4710 |
||||
web: |
||||
build: . |
||||
ports: |
||||
- "5000:5000" |
||||
environment: |
||||
ADUNATIO_PRIV_KEY: /code/privkey.pem |
||||
volumes: |
||||
- .:/code |
@ -1,16 +1,24 @@ |
||||
# This is a sample Python script. |
||||
from flask import Flask |
||||
from flask_admin.contrib.mongoengine import ModelView |
||||
from mongoengine import connect |
||||
|
||||
# Press Shift+F10 to execute it or replace it with your code. |
||||
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings. |
||||
from models.Union import Union |
||||
from models.User import User |
||||
from restapi import MongoApi |
||||
from flask_admin import Admin |
||||
""" |
||||
Mongodb connection string |
||||
""" |
||||
connect('adunatio', host='mongo',username="xcoder",password="4dun4710", authentication_source='admin') |
||||
|
||||
|
||||
def print_hi(name): |
||||
# Use a breakpoint in the code line below to debug your script. |
||||
print(f'Hi, {name}') # Press Ctrl+8 to toggle the breakpoint. |
||||
app = Flask(__name__) |
||||
app.secret_key = "secret_key+secret_key" |
||||
api = MongoApi(app) |
||||
api.register_model(User,uri="/api/user") |
||||
adm = Admin(app) |
||||
adm.add_view(ModelView(User)) |
||||
adm.add_view(ModelView(Union)) |
||||
|
||||
|
||||
# Press the green button in the gutter to run the script. |
||||
if __name__ == '__main__': |
||||
print_hi('PyCharm') |
||||
|
||||
# See PyCharm help at https://www.jetbrains.com/help/pycharm/ |
||||
app.run(host="0.0.0.0",port=5000,debug=True) |
Loading…
Reference in new issue