Python Daily
2.57K subscribers
1.48K photos
53 videos
2 files
38.9K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
How does a Flask app serve multiple users/requests at once?

How does a Flask/Django app which is synchronous and single threaded serve multiple users at once?

Im learning a bit of JS off a playlist on Youtube and a video discusses async programming and its advantages in context of I/O. This made me wonder: are there certain kinds of web applications which are better suited to being developed using Node.js than a Python framework? Since a lot of the general web apps(read CRUD) need database access, would all such apps be better off being written in Node ?

/r/flask
https://redd.it/cesmvt
ELK (Elasticsearch, Logstash & Kibana) stack setup in Django

Hey everyone.. Has anybody worked on ELK stack in their Django project?? If so please help me in integrating in my project.. Its really blowing up my mind and i need to finish the task.. Also if you could show some code that will be great..

I googled it and know what is the use of it but how to integrate it with Django i just couldn't understand.

/r/django
https://redd.it/cf2oxt
Debugging Flask on a digital ocean droplet server (using ubuntu)

Recently I deployed my first Flask application on a Droplet that uses an Ubuntu with nginx and uWSGI.

Now, I have a problem and I can't use the GET/POST methods to signup and login, at least that is what I hypothesised, because I filled every input for the signup and when I tried to login I couldn't. Furthermore I tried to login with wrong credentials and I got an error, which is normal since I programmed it to output an error if I tried to login as a non-user.


Now if you try to recreate that exact problem follow [this tutorial](https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-uswgi-and-nginx-on-ubuntu-18-04) and instead of the simple app that it uses just [git clone this repo](https://github.com/anfederico/Flaskex) which is a Flask example that uses an SQLite db (that is what I used as my base app to create the one that I wanted to deploy, so I thought that if it worked my Flask app will work as well).


But to summarize my problem; **I can't access the sub directories of my Flask app, using login/signup methods and I don't know how to debug that.**


Can anyone help me with that?

/r/flask
https://redd.it/cf4r9l
I made an application which shows a new motivational quote every 2 minutes.

/r/Python
https://redd.it/cf3n3v
[P] I made a video review of The Hundred-Page Machine Learning Book

I enjoy learning about machine learning.

And I enjoy making videos.

So I made a video reviewing [The Hundred-Page Machine Learning Book](https://themlbook.com) by Andriy Burkov.

I read it from the perspective of a machine learning engineer and still learned a bunch.

If you haven't checked out the book, it's a great concise read. There's nothing like a complex topic explained simply.

If you do watch the video, any advice on ways to improve or future reviews/topics would be greatly appreciated.

[https://youtu.be/btLxTTkSZuY](https://youtu.be/btLxTTkSZuY)

/r/MachineLearning
https://redd.it/cf4rh5
[P] Comprehensive Machine Learning Trading Strategies - Google Colab

100+ Machine Learning Trading Strategies

[https://github.com/firmai/machine-learning-asset-management](https://github.com/firmai/machine-learning-asset-management)

​

\- Deep Learning

\- Reinforcement Learning

\- Evolutionary Strategies

\- Stacked Models

/r/MachineLearning
https://redd.it/cf111a
How to link Flask static files?

I am making a basic blog using HTML,and CSS. I linked my HTML file but I am having trouble linking the CSS.

This is the following code:

from flask import Flask,render_template,url_for

app = Flask(__name__)

@app.route('/')
def hello_world():
return render_template('home.html'), url_for('static', filename='main.css')

Thanks,

/r/flask
https://redd.it/cf7zr4
Is there a tutorial around to make a reddit like site?

I've googled it but keep finding reddit threads about making django sites. I would like to make something like reddit, but not sure where to start. Having a guide or tutorial I could follow would help a lot.

/r/django
https://redd.it/cfbapi
Pythonanywhere email send does not work

So I just released my site on Pythonanywhere, but one of my features is not working. A user presses a button after filling out a form, and then the data is saved to my admin (which works) and an email is supposed to send to out me and the user. However, the email is not going out. When I try it on my local machine with the same code, it works, but on the pythonanywhere it doesnt.

/r/django
https://redd.it/cfgffy
Updating static files?

So currently, the only way I can get changes to static files to take in my app is to add version numbers to my <link> like so:

<link href="{url_for('static', filename='css/style.css', version='30')}" rel="stylesheet">

But this can get tedious if you're just making incremental changes while testing. So is there a better way to update my static files and have them take effect without constantly changing the version number?

/r/flask
https://redd.it/cf9lrp
Pure Python Implementation of 100+ Stock Trading Strategies - Google Colab

I have always held the belief that one of the best ways to learn about data-science/python is to find problems to solve in finance where the data is plentiful.

I will add the list here so that you won't have to go to GitHub or the SSRN file. It is a list of a few strategies and some portfolio optimisation techniques. They all have an ML bent. Like before any criticism and feedback is highly appreciated.

Source: [https://github.com/firmai/machine-learning-asset-management](https://github.com/firmai/machine-learning-asset-management)

**1. Tiny CTA**
*Resources*:
See this [paper](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2695101) and [blog](https://www.linkedin.com/pulse/implement-cta-less-than-10-lines-code-thomas-schmelzer/) for further explanation.
[Data](http://drive.google.com/open?id=12BB8KpFYJSx41yvHhtoLYE_ZZOHNamP8), [Code](https://drive.google.com/open?id=1EwbHhBZL_PRTphR25EbMQA9dV7jC4CjT)

**2. Tiny RL**
*Resources*:
See this [paper](http://cs229.stanford.edu/proj2006/Molina-StockTradingWithRecurrentReinforcementLearning.pdf) and/or [blog](https://teddykoker.com/) for further explanation.
[Data](https://drive.google.com/open?id=1k7J5y1xCssIna45d_Xw78d2frgzD94Li), [Code](https://drive.google.com/open?id=1IRrR6kWjunERzZqrszJ9_q-C1Yj5L0Qj)

**3. Tiny VIX CMF**
*Resources*:
[Data](https://drive.google.com/open?id=1Yv2_mTjZMANoL9fM0ajOsOFEc9MJZAMU), [Code](https://drive.google.com/open?id=186j-gtkXCgzj06WCWDAU9yhYXP9SfgLu)

**4. Quantamental**
*Resources*:
[Web-scrapers](https://drive.google.com/drive/folders/12aZ7vg_3HIdPYZ4GavYY7BjptlAPGFtc?usp=sharing), [Data](https://drive.google.com/open?id=1b0OXiSKnacEDftYKgov619SCfXwpcUWT), [Code](https://drive.google.com/open?id=1PqtFfcr1ejreGr6XIoZCs8jsD7AccuL7), [Interactive Report](https://github.com/firmai/interactive-corporate-report), [Paper](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3420490).

**5. Earnings Surprise**
*Resources*:
[Code](https://drive.google.com/open?id=1KtGauKizS8QISuDCW0SwIxbYPeBwTQxF), [Paper](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3420722)

**6. Bankruptcy Prediction**
*Resources*:
[Data](https://drive.google.com/open?id=1UAIZBNHag-AdWZ4z7nd_y5THQ89D-IQh), [Code](https://drive.google.com/open?id=1Z2ZyvEoWsRfHSa1f7g0m1O-JiXedUdb_), [Paper](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3420889)

**7. Filing Outcomes**
*Resources*:
[Data](https://drive.google.com/open?id=1cDhrrAp07e-2TgrPQginXUNQpdbTpq-u)

**8. Credit Rating Arbitrage**
*Resources:*
[Code](https://drive.google.com/open?id=1i_yERL4i6qp57C0LdSWEV8iYv_rtAZLF)

**9. Factor Investing:**
*Resources:*
[Paper](https://docplayer.net/120877135-Industry-return-predictability-a-machine-learning-approach.html), [Code](https://drive.google.com/open?id=1O0LQ_khTfsbFG5aN3-AqV6DEIRWQ6UuP), [Data](https://drive.google.com/open?id=1cc43729RyOPCsDJ3r46SdHcJJp1AUmaA)

**10. Systematic Global Macro**
*Resources:*
[Data](https://drive.google.com/open?id=1ePKFtfjBrfg3xDtg_dbssykeSd8ZmA1z), [Code](https://drive.google.com/open?id=10bN3kNjl9EMDB5Tt1ArXO8IaxLiPh_Zd)

**11. Mixture Models**
*Resources*:
[Data](https://drive.google.com/open?id=1jmR2Jlk6Hy7J7c2jZFEK1oXptOHbDYLK), [Code](https://drive.google.com/open?id=1tRIt7lIJErWKwoHIuBS6rZbZo2EYBNTN)

**12. Evolutionary**
*Resources*:
[Code](https://drive.google.com/open?id=116Aj9kbZcrCyR5MDu58HkWE53lacAE52)

**13. Agent Strategy**
*Resources*:
[Code](https://drive.google.com/open?id=1qCvIeui5dJKMXnjUm9_wiPf65VVHdWwz)

**14. Stacked Trading**
*Resources*:
[Code](https://drive.google.com/open?id=11SG9KIWUxV9fgrrpAs0QifgGrcdzk2dh), [Blog](https://www.kdnuggets.com/2017/02/stacking-models-imropved-predictions.html)

**15. Deep Trading**
*Resources*:

/r/Python
https://redd.it/cfevn9
Receiving and then Serving image files

So I get an image file with the following sample URL (http://localhost:8096/image/blah). I would like to then serve this image via a flask route.

So I have at the moment

@app.route('/image/blah')
def __blahimage():
import requests
r = requests.get('http://localhost:8096/image/blah')
#Response 200
return send_file(r.text)

This does not seem to be the correct way. I'm new to Python in general and the reason I'm doing this is because the images are available on a local server only. The flask is a wrapper essentially.

/r/flask
https://redd.it/cfka7t
Is Flask a good fit for this kind of service ?

Hi everyone,

I'm in the very early stages of evaluating the technical options available for an online tool. So far my research showed me that yes, Flask is a good solution. I've always heard good things about it, but I'd like to get some reinsurance from people who work with it on a daily basis.

I play a bit with Python myself but I'm nowhere near a technical guy. I'm probably unaware of the best ways to handle, store, feed and serve large data stream. Pardon in advance any incongruous consideration.

&#x200B;

Here's the big picture : get data from APIs/scraping > do some data wrangling > serve that to a pretty font-end.

Flask can do that as far as I know.

Now at first the features should be basic:

Pull data from APIs > do some parsing & statistical stuff with it (Pandas, Geopandas), feed some dashboards with tables / dynamic graphs, add vector layers to maps.

&#x200B;

From what I understand, for the earlier, more basic phase, I should do fine with a good fullstack dev and a good server and that should be enough to get the thing up and running (+ maintenance), right ?

&#x200B;

Later on some additional tasks could be added, such as:

* scrape

/r/flask
https://redd.it/cflc3p
My Website (Audio Converter) which has a Flask/Python backend.

This is a non-profit website that I work on in my free time. Many formats are supported. No software to download and easy to use.

You can access my website via either of the following URLs:

https://onlineaudioconverter.net

https://freeaudioconverter.net

Feedback is welcome :)

/r/flask
https://redd.it/cfol51