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
Python Flask job in 15 y.o

Hi everyone, I have been learning Flask framework for more then one year, and I think I have pretty good experience, but I have a problem finding Flask backend job without completed high school or university. What should I do to make some money with Flask?

Thanks for your opinion

/r/flask
https://redd.it/idg0z3
Flask to break into freelance?

Hi all,

I've been learning Python for around a year (actually off & on over the last 5 years), and have done some side projects at work involving .csv's and automation. More recently, I've played around with Flask and built a simple site called spacewa.com ... I am interested in moving into freelance, and hopefully, a full time dev job. I've got a bit of Linux and AWS experience, along with Python & Flask, already mentioned. I would be looking for remote work mostly likely--is Flask a way to get my foot in the door? Could I realistically start building some basic sites or API's as a freelancer? What is the market like?

Many thanks!

/r/flask
https://redd.it/idjyk9
Please excuse my level of inexperience and help me out please

I’m currently trying to deploy a very very basic website if you can even call it that to heroku just to make sure it’ll work. I was able to successfully load my one index.html file located in a templates folder within the GitHub repository I am using to deploy. The file contains links to other html files within that same templates folder. Now the index.html file loads fine but the links to the html files result in a Not Found Error.

My current app.py program looks like this:

#DEPLOY VERSION_v1.0.1 null(1)
from flask import Flask, render_template, request
from flask_sqlalchemy import SQLAlchemy


app= Flask(__name__)


@app.route('/')
def index():
return render_template('index.html')


if __name__ == '__main__':
app.run()




How would I go about fixing this error?

P.s. you can ignore my import lines at the very beginning, they’re for use later.

/r/flask
https://redd.it/id61ka
Simple plugin to create easily editable tables.

Hello. I need ability to simply and easily to create HTML tables. Easy edit ability would be key. Is there a django plugin that allows easily create tables in the admin page and then storing them into the database.

The idea is kinda like having blog where sometimes instead of just posting image and some text and table displaying some simple data.

/r/django
https://redd.it/idj826
I want to show "username/password are incorrect" after user input incorrect password. How to show that message? can someone help me?? Below is the code of login in views.



​

def login(request):

if request.method == 'POST':

form = AuthenticationForm(data=request.POST)

if form.is\_valid():

user = form.get\_user()

authlog(request, user)

return redirect('users')

else:

back\_page = request.META.get('HTTP\_REFERER')

return redirect('login')

\# return HttpResponse(back\_page)

/r/django
https://redd.it/idrt0w
[D] A good resource for MLE interivew

Hi,

If you're preparing for an interview, you might want to check out: [https://github.com/khangich/machine-learning-interview](https://github.com/khangich/machine-learning-interview)

I compiled this from my actual interview experiences. Hope it helps. I'm still looking for good material about A/B testing and MultiArm bandit. I appreciate it if you can give me some links.

​

I originally posted in r/learnmachinelearning but I think there will be more experts here that can help and give feedback.

Cheers.

/r/MachineLearning
https://redd.it/idr5be
Convert python script to Jupyter and save the output in html

I have a python script, which takes --daysparams and outputs graphs for the range, i want to convert this python script to Jupyter notebook and execute the code and save the output in html format.

>parser = argparse.ArgumentParser()
>
>parser.add\_argument( "--days", type=int, default=1, help="Specify number of days data needed, else defaults to 1 day", )
>
>args = parser.parse\_args()

above lines gets saved in a Jupyter cell on conversion, how do pass the days argument while executing the jupyter notebook ?

Used papermill for execution and ran into the below error:

>Output Notebook: mynotebook\_output.ipynb Executing: 0%| | 0/13 \[00:00<?, ?cell/s\]Executing notebook with kernel: python3 Executing: 15%|███████████▊ | 2/13 \[00:01<00:09, 1.17cell/s\] Traceback (most recent call last): File "/home/sanju/.local/bin/papermill", line 8, in <module> sys.exit(papermill()) File "/home/sanju/.local/lib/python3.6/site-packages/click/core.py", line 829, in \_\_call\_\_ return self.main(\*args, \*\*kwargs) File "/home/sanju/.local/lib/python3.6/site-packages/click/core.py", line 782, in main rv = self.invoke(ctx) File "/home/sanju/.local/lib/python3.6/site-packages/click/core.py", line 1066, in invoke return ctx.invoke(self.callback, \*\*ctx.params) File "/home/sanju/.local/lib/python3.6/site-packages/click/core.py", line 610, in invoke return callback(\*args, \*\*kwargs) File "/home/sanju/.local/lib/python3.6/site-packages/papermill/cli.py", line 238, in papermill execution\_timeout=execution\_timeout, File "/home/sanju/.local/lib/python3.6/site-packages/papermill/execute.py", line 110,

/r/JupyterNotebooks
https://redd.it/idtnm4
Are there free alternatives to Twilio for SMS notifications?

I want to do SMS notifications from my Django app, but it seems like the standard is Twilio’s paid service. Just curious before I go this route, are there any free alternatives anyone can recommend?

I’m already paying $20 a month for proxies, and $5 a month for Digital Ocean, so I’d like to keep further costs to a minimum if possible.

/r/django
https://redd.it/idx56p
Friday megathread: Free chat Friday!

Use this thread to talk about anything Python related! Questions, news, projects and any relevant discussion around Python is permitted!

/r/Python
https://redd.it/idlz52
Missing the Scripts folder in Anaconda

Hey guys! I don't know if this is the right sub for this question, but I've tried to download Anaconda to my Windows (10, 64-bit) and its missing the Scripts folder no matter how many times I uninstall and reinstall it. So I also don't have the navigator or the prompt files. Can you guys recommend me somethi g to solve this problem?

/r/JupyterNotebooks
https://redd.it/idi25r
Why is my JWT access token saved into my cookies when I log in manually from the back end, but not from the front end?

So, I'm using GatsbyJS on the front end on port 8000 and Django REST Framework on the back end on port 7000. All I want to do is sign the user in using their username and password as credentials. I'm using a combination of `dj-rest-auth` and `all-auth` to handle JWT authentication. Here are the paths I've created:

* Registration: `/auth/registration/`
* Logging In: `/auth/login/`
* Logging Out: `/auth/logout/`
* Getting Current User Information: `/auth/user/`

When I log the user in from the back end (`localhost:7000/auth/login/`), I get back the access token, refresh token, and relevant user data (e.g. id, username, email, etc.). When I log the user in from the front end (`localhost:8000` \- code below), I get the exact same data back from [`response.data`](https://response.data) \- access token, refresh token, and relevant user data. The only difference between the two is that, when I log in from the back end endpoint, the access token is safely stored within an HttpOnly cookie. However, when I log in from the front end (i.e. hit `localhost:7000/auth/login/` using Axios), while I get back the same response data, my access token isn't being saved into an HttpOnly cookie, let alone being saved on the browser at all. When trying to

/r/django
https://redd.it/idxr6p
How to generate card token in a react native app?

Hi I am trying to develop a mobile app using react native and Django. From docs I got to know about the ensure_csrf_token decorator but I have no idea how to generate csrf token in a mobile app. Also which url should I white list in the settings.py file to enable my react native app to fetch data from the Django server. I am using drf btw

/r/djangolearning
https://redd.it/ie1i7c
Snake game in a single line of python

This is a fully functional game of snake in a single line of python using pygame. I did this mostly as a challenge to myself to see how compact I can make code, similar to code golf. I got it down to less than 3K characters, but I could easily get much less by shortening variable names.

[source code](https://github.com/tjf801/oneliners/blob/master/snake.py)

edit: some bug fixes made it go over 3K chars

/r/Python
https://redd.it/idxmnt
django celery

Hi, I'm trying out celery and it works but it seems like celery does not complete the task. I've checked celery docs and it seems like there isn't a time limit set on completing the task.

user = User.objects.get(id=user_id)
scraperecord = ScrapeRecord.objects.create(user=user, query=query)
print(article_elements)
for article in article_elements:
h2 = article.find_element_by_tag_name("h2")
article_title = h2.text
if re.match('^person', article_title):
continue

a =

/r/django
https://redd.it/ie1l6q
Saturday megathread: Share your resources!

Found a neat resource related to Python over the past week? Looking for a resource to explain a certain topic?

Use this thread to chat about and share Python resources!

/r/Python
https://redd.it/ie8bg0
I made a python script that joins Google Meet automatically with my camera and microphone turned off according to my schedule!

I made a python script using selenium to join my online classs on google meet. Fairly basic; Do take a quick look and feel free to give suggestions.

[Github Repo](https://github.com/utkrixx/Google-Meet-automation-with-Python)

/r/Python
https://redd.it/ie04v4
A Cheatsheet for all the Data Structures in Python

/r/Python
https://redd.it/iec5la