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
Django - PostHog analytics

Hi guys, I'm adding PostHog to my site I'm wondering what's better, installing PostHog to the Django server or installing it to the JS.

I think the same question would be if I were using Google Analitycs instead of PostHog.

Thanks!

/r/djangolearning
https://redd.it/uy7awd
Is there anyone who is graduated from Pybites "PDM program"? Is it worth it?

Is there anyone who is graduated from Pybites "PDM program"? Is it worth it?

Can you please share your experience with this program?

Anyone takes "PyBites Challenges"? What's your comment about their platform?

/r/django
https://redd.it/uycqvh
Sunday Daily Thread: What's everyone working on this week?

Tell /r/python what you're working on this week! You can be bragging, grousing, sharing your passion, or explaining your pain. Talk about your current project or your pet project; whatever you want to share.

/r/Python
https://redd.it/uzzd07
Can someone explain how to share models between apps?

So I'm new to django, and this is confusing as hell to me...

​

\- So I create my django project, and it automatically creates the database file.

\- I create an app, and in that app I make some models in my models.py

\- I make migrations, and django adds the models as tables to the database.

\- I create a second app, and I need that app to access the data in those tables.

​

How does the second app access the tables? Python won't let me import models.py without giving me a 'ModuleNotFound' error.

I know I can add a statement to settings.py to add the directory to sys.path, which will get it to work, but that feels hacky to me, and I'm concerned that there's just better ways of doing things with django that I'm not aware of.

If anyone can clear this up for me, I would appreciate it. Thank you!

​

EDIT: SOLVED!

​

thank you to u/timlwhite!

Turns out I had added my apps to INSTALLED_APPS incorrectly - I had just added 'my_app' instead of 'my_app.apps.MyAppConfig'

/r/django
https://redd.it/uzww8l
Stress Test / Limits of Web App

I have pushed to production on PythonAnywhere a web app that is essentially a glorified url shortener. Users can register, save a dozen of links and select one of them as their redirect page hosted at user_uuid/action . The app has been working well so far, but I plan to add about 500 users in the next 6 months. How can I roughly estimate the number of requests that the web app is able to bear? Is there a way to stress test?

/r/flask
https://redd.it/v0z21r
Django + Celery + AWS SQS setup on Elastic Beanstalk

Hi,

I am having a lot of trouble with the deployment to AWS Elastic Beanstalk of a Django app that uses Celery.

I want to deploy an app that runs a simple task every minute and prints something to the console. (I have the code attached below)

Locally, it works flawlessly

I start the beat: celery -A dcf\_env beat -l INFO
I start the worker: celery -A dcf_env worker -l INFO -P solo

I made an SQS queue named 'my-queue' which receives messages from my beat. And my worker successfully consumes the messages from the queue and prints something to the console.

I can't understand how to start the beat and the worker in AWS Elastic Beanstalk. Are they even supposed to run in Elastic Beanstalk, or do I need to use some other service like a separate EC2 instance?

What do my .config files need to look like in .ebextensions folder? Is my project structure even correct? (Project Structure photo attached below)

I have deployed the application without Celery before, but now I want to integrate the project with Celery running this simple_task.

Can anyone point me to the right tutorial on how to set this up, or any up to date documentation? Any help would be

/r/django
https://redd.it/v0uael
Tuesday Daily Thread: Advanced questions

Have some burning questions on advanced Python topics? Use this thread to ask more advanced questions related to Python.

If your question is a beginner question we hold a beginner Daily Thread tomorrow (Wednesday) where you can ask any question! We may remove questions here and ask you to resubmit tomorrow.

This thread may be fairly low volume in replies, if you don't receive a response we recommend looking at r/LearnPython or joining the Python Discord server at https://discord.gg/python where you stand a better chance of receiving a response.

/r/Python
https://redd.it/v1dbgz
Wednesday Daily Thread: Beginner questions

New to Python and have questions? Use this thread to ask anything about Python, there are no bad questions!

This thread may be fairly low volume in replies, if you don't receive a response we recommend looking at r/LearnPython or joining the Python Discord server at https://discord.gg/python where you stand a better chance of receiving a response.

/r/Python
https://redd.it/v23qzz
Thursday Daily Thread: Python Careers, Courses, and Furthering Education!

Discussion of using Python in a professional environment, getting jobs in Python as well as ask questions about courses to further your python education!

This thread is not for recruitment, please see r/PythonJobs or the thread in the sidebar for that.

/r/Python
https://redd.it/v2vgf8
Making a Custom Graph in Jupyter Noteboook

I'm interested in plotting nontraditional logic,math, and networking graphs that don't fall on xy planes or maps. Does anyone know good tutorials for making these nontraditional graphs in Jupyter notebook I would also like them to be interactive?

/r/JupyterNotebooks
https://redd.it/v3h6or
How to connect SQL Server to Jupyter

Hello guys! Does anyone know how's the best way to connect to SQL Server through Jupyter Notebooks?

​

Thanks in advance

/r/JupyterNotebooks
https://redd.it/v780gr
Old android phone as flask test server

I know this isn't anything new, but I hadn't considered this before so thought I'd share. Flask apps are pretty lightweight so I pulled out an old Pixel 3 XL I had laying around and repurposed it into a flask dev server in no time and doesn't require rooting (unless you want docker). Shouldn't harm anything, but usual disclaimer if you try this on your primary phone.

1. Factory reset phone for good starting base (Optional, recommended if you aren't using it)
1. Also connect to wifi
2. Install termux (from f-droid, not the app store)
1. Download apk: f-droid.org/repo/com.termux_118.apk
2. Allow install from external sources and install
3. Launch termux
3. Set password and update environment
1. passwd
2. pkg update && pkg upgrade
4. Install and run ssh server (dropbear for convenience)
1. pkg install dropbear
2. dropbear
5. Termine IP address and test ssh (should be able to access)
1. ifconfig|grep inet
6. Install python
1. pkg install python
7. Create your flask application, scp it over if needed, and run in termux
1. flask run -h 0.0.0.0 -p 5000
8. You should

/r/flask
https://redd.it/vlz6kt
Sunday Daily Thread: What's everyone working on this week?

Tell /r/python what you're working on this week! You can be bragging, grousing, sharing your passion, or explaining your pain. Talk about your current project or your pet project; whatever you want to share.

/r/Python
https://redd.it/vq4m4j
Wednesday Daily Thread: Beginner questions

New to Python and have questions? Use this thread to ask anything about Python, there are no bad questions!

This thread may be fairly low volume in replies, if you don't receive a response we recommend looking at r/LearnPython or joining the Python Discord server at https://discord.gg/python where you stand a better chance of receiving a response.

/r/Python
https://redd.it/vsc2cv
Thursday Daily Thread: Python Careers, Courses, and Furthering Education!

Discussion of using Python in a professional environment, getting jobs in Python as well as ask questions about courses to further your python education!

This thread is not for recruitment, please see r/PythonJobs or the thread in the sidebar for that.

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