reduced slack functionality, higher ease of use. Database migration wip
This commit is contained in:
@@ -1,25 +1,25 @@
|
||||
FROM node:18.8 as build-deps
|
||||
|
||||
WORKDIR /app
|
||||
WORKDIR /app/client
|
||||
COPY client/package.json ./
|
||||
COPY client/package-lock.json ./
|
||||
COPY client/rollup.config.js ./
|
||||
COPY client/src ./src/
|
||||
RUN npm install
|
||||
RUN npm run build
|
||||
|
||||
|
||||
FROM python:latest
|
||||
ENV TZ Europe/Zurich
|
||||
|
||||
RUN apt-get update && apt-get install -y postgresql
|
||||
|
||||
RUN mkdir -p /app/news_check
|
||||
|
||||
COPY requirements.txt /app/requirements.txt
|
||||
RUN python3 -m pip install -r /app/requirements.txt
|
||||
COPY --from=build-deps /app/public /app/news_check/public
|
||||
|
||||
COPY app /app/news_check
|
||||
WORKDIR /app/news_check
|
||||
|
||||
CMD gunicorn app:app -w 1 --threads 2 -b 0.0.0.0:80
|
||||
COPY requirements.txt requirements.txt
|
||||
RUN python3 -m pip install -r requirements.txt
|
||||
|
||||
COPY client/public/index.html client/public/index.html
|
||||
COPY --from=build-deps /app/client/public client/public/
|
||||
COPY server server/
|
||||
|
||||
WORKDIR /app/news_check/server
|
||||
# CMD python app.py
|
@@ -4,10 +4,9 @@
|
||||
<meta charset='utf-8'>
|
||||
<meta name='viewport' content='width=device-width,initial-scale=1'>
|
||||
|
||||
<title>Svelte app</title>
|
||||
<title>NEWS CHECK</title>
|
||||
|
||||
<link rel='icon' type='image/png' href='/favicon.png'>
|
||||
<link rel='stylesheet' href='/global.css'>
|
||||
<link rel='icon' type='image/png' href='https://ethz.ch/etc/designs/ethz/img/icons/ETH-APP-Icons-Theme-white/192-xxxhpdi.png'>
|
||||
<link rel='stylesheet' href='/build/bundle.css'>
|
||||
|
||||
<script defer src='/build/bundle.js'></script>
|
||||
@@ -16,7 +15,7 @@
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.0.943/pdf.min.js"></script>
|
||||
<html data-theme="light"></html>
|
||||
<html data-theme="light"></html> <!-- Daisy-ui theme -->
|
||||
|
||||
</head>
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
flask
|
||||
peewee
|
||||
markdown
|
||||
gunicorn
|
||||
psycopg2
|
@@ -1,10 +0,0 @@
|
||||
# Svelte.js + Flask
|
||||
|
||||
A super simple example of using Flask to serve a Svelte app and use it as a backend server.
|
||||
|
||||
Run the following for development:
|
||||
|
||||
- `python server.py` to start the Flask server.
|
||||
- `cd client; npm install; npm run autobuild` to automatically build and reload the Svelte frontend when it's changed.
|
||||
|
||||
This example just queries the Flask server for a random number.
|
@@ -1,4 +1,3 @@
|
||||
from crypt import methods
|
||||
import json
|
||||
from flask import Flask, send_from_directory, jsonify
|
||||
import random
|
||||
@@ -7,7 +6,8 @@ app = Flask(__name__)
|
||||
|
||||
|
||||
###############################################################################
|
||||
# SVELTE BACKEND. Always send index.html and the requested js-files. (compiled by npm)
|
||||
# SVELTE 'STATIC' BACKEND. Always send index.html and the requested js-files. (compiled by npm)
|
||||
|
||||
@app.route("/") #index.html
|
||||
def base():
|
||||
return send_from_directory('../client/public', 'index.html')
|
||||
@@ -17,6 +17,7 @@ def home(path):
|
||||
|
||||
|
||||
|
||||
|
||||
###############################################################################
|
||||
# API for news_check.
|
||||
|
||||
@@ -34,4 +35,4 @@ def set_article(id):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(debug=True)
|
||||
app.run(host="0.0.0.0", port="80")
|
3
news_check/server/package-lock.json
generated
3
news_check/server/package-lock.json
generated
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"lockfileVersion": 1
|
||||
}
|
20
news_check/test.py
Normal file
20
news_check/test.py
Normal file
@@ -0,0 +1,20 @@
|
||||
import peewee
|
||||
|
||||
db = peewee.PostgresqlDatabase('coss_archiving', user='ca_rw', password='pleasechangeit', host='vpn', port=5432)
|
||||
# db.connect()
|
||||
|
||||
|
||||
class Pet(peewee.Model):
|
||||
name = peewee.CharField()
|
||||
animal_type = peewee.CharField()
|
||||
|
||||
class Meta:
|
||||
database = db # this model uses the "people.db" database
|
||||
with db:
|
||||
db.create_tables([Pet])
|
||||
db.get_tables()
|
||||
|
||||
t = Pet.create(name="Test", animal_type="test")
|
||||
|
||||
for pet in Pet.select():
|
||||
print(pet.name)
|
Reference in New Issue
Block a user