Change arch to be able to deploy to pypi
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Michel Roux 2020-04-09 20:47:56 +02:00
parent 4d0784112e
commit 0bae69ef2f
35 changed files with 28 additions and 35 deletions

View File

@ -1,10 +0,0 @@
.idea
.venv
.db
.env
.git
build
dist
*.egg*
__pycache__
test.py

View File

@ -2,10 +2,12 @@ FROM python:slim
ENV DEBIAN_FRONTEND noninteractive
ENV LANG C.UTF-8
COPY . /app
COPY pynyaata /app/pynyaata
COPY requirements.txt /app
COPY run.py /app
WORKDIR /app
RUN apt-get update && apt-get -y upgrade && apt-get -y install locales && \
printf "en_US.UTF-8 UTF-8\nfr_FR.UTF-8 UTF-8\n" > /etc/locale.gen && \
locale-gen && rm -rf /var/lib/apt/lists/* && \
pip install -r requirements.txt
CMD ["python", "app.py"]
CMD ["python", "run.py"]

View File

@ -5,7 +5,7 @@ services:
build: .
ports:
- "5000:5000"
entrypoint: python3 app.py
entrypoint: python3 run.py
working_dir: /app
depends_on:
- db

0
pynyaata/__init__.py Normal file
View File

View File

@ -1,15 +1,14 @@
from operator import attrgetter, itemgetter
from time import sleep
from flask import redirect, render_template, request, url_for, abort
from config import app, auth, ADMIN_USERNAME, ADMIN_PASSWORD, APP_PORT
from connectors import *
from forms import SearchForm, DeleteForm, EditForm
from pynyaata.config import app, auth, ADMIN_USERNAME, ADMIN_PASSWORD
from pynyaata.connectors import *
from pynyaata.forms import SearchForm, DeleteForm, EditForm
if MYSQL_ENABLED:
from config import db
from models import AnimeFolder, AnimeTitle, AnimeLink
from pynyaata.config import db
from pynyaata.models import AnimeFolder, AnimeTitle, AnimeLink
def clean_model(obj):
@ -197,13 +196,3 @@ def admin_edit(link_id=None):
link.vf = False
return render_template('admin/edit.html', search_form=SearchForm(), link=link, folders=folders, action_form=form)
if __name__ == '__main__':
while True:
try:
app.run('0.0.0.0', APP_PORT, IS_DEBUG)
except Exception as e:
getLogger().exception(e)
sleep(10)
pass

View File

@ -11,7 +11,7 @@ from bs4 import BeautifulSoup
from cloudscraper import create_scraper
from requests import RequestException
from config import IS_DEBUG, MYSQL_ENABLED, CACHE_TIMEOUT, BLACKLIST_WORDS
from pynyaata.config import IS_DEBUG, MYSQL_ENABLED, CACHE_TIMEOUT, BLACKLIST_WORDS
scraper = create_scraper()
@ -103,7 +103,7 @@ def curl_content(url, params=None, ajax=False):
def link_exist_in_db(href):
if MYSQL_ENABLED:
from models import AnimeLink
from pynyaata.models import AnimeLink
return AnimeLink.query.filter_by(link=href).first()
return False

View File

@ -1,6 +1,6 @@
from config import app
from connectors import curl_content
from models import AnimeLink
from pynyaata.config import app
from pynyaata.connectors import curl_content
from pynyaata.models import AnimeLink
app.config['SQLALCHEMY_ECHO'] = False
links = AnimeLink.query.all()

View File

@ -1,4 +1,4 @@
from config import db
from pynyaata.config import db
class AnimeFolder(db.Model):

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 119 B

After

Width:  |  Height:  |  Size: 119 B

View File

Before

Width:  |  Height:  |  Size: 134 KiB

After

Width:  |  Height:  |  Size: 134 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 434 KiB

After

Width:  |  Height:  |  Size: 434 KiB

12
run.py Normal file
View File

@ -0,0 +1,12 @@
from logging import getLogger
from time import sleep
from pynyaata.config import app, APP_PORT, IS_DEBUG
while True:
try:
app.run('0.0.0.0', APP_PORT, IS_DEBUG)
except Exception as e:
getLogger().exception(e)
sleep(10)
pass