« first day (2007 days earlier)      last day (1359 days later) » 

1:31 PM
I got a strange issue, when using pypi.org/project/flask-worker flask worker, then I get jinja2.exceptions.TemplateNotFound: main.html, but when I run the app without flask worker it works. It seems strange because os.getcwd shows the same dir in both cases and app.template_folder shows templates in both cases. Any idea what flask-worker is doing so that flask can't find my templates?
Ok, I have an mvce which shows the issue:
from flask_worker_additions.factory import create_app, db, socketio
from flask import Flask, render_template

use_flask_worker = True

if use_flask_worker:
    app = create_app()
else:
    app = Flask(__name__, static_url_path='/static')

if use_flask_worker:
    @app.before_first_request
    def before_first_request():
        db.create_all()


@app.route("/")
def main_page():
    return render_template("main.html")


if use_flask_worker:
    socketio.run(app, host="0.0.0.0", debug=True)
else:
and flask_worker_additions.factory is just the same as in the tutorial, no clue why they didn't bundle that into the flask_worker package instead of having me write it. I guess because it's lots of configs stuff maybe
from flask_worker import Manager

from flask import Flask
from flask_socketio import SocketIO
from flask_sqlalchemy import SQLAlchemy
from redis import Redis
from rq import Queue
import eventlet
import os

db = SQLAlchemy()
eventlet.monkey_patch(socket=True)
socketio = SocketIO(asynch_mode='eventlet')
# initialize a Manager with the database and socketio
manager = Manager(db=db, socketio=socketio)


def create_app():
    app = Flask(__name__, static_url_path='/static')
    app.config['SQLALCHEMY_DATABASE_URI'] = (
nvm, nvm I'm stupid
somebody please delete this mess. It was ofc the name
 
7 messages moved from Python
 
 
3 hours later…
4:42 PM
I am thinking of only using data center IPs instead of residential IPs to extract some data from e-commerce sites since they're so much more cheaper but i'm wondering if most of them will get blocked
 
@Pherdindy doesn't sound like something ethical and something on-topic here
so...ask on reddit?
 
Right where can I find if the site allows what
Always wondered if I can scrape some data
I only plan to do it very minimally of course
But I wonder if they have some terms to be found usually since i'm quite new to this
I was never really a reddit guy but I guess I can take a look
 
@Pherdindy yeah, you're not new at all. You were asking here in 2018 about trying to get around rate limiting when you were scraping an e-commerce website. We discussed in length that you should be looking at their terms of service.
so please cut the crap
10 messages moved from Python
 

« first day (2007 days earlier)      last day (1359 days later) »