Help deploying my first project to production.
Hello,
I have a little experience with Django and Ive recently just finished developing my first solo django project. Its an art website for my dad’s paintings that features a home page, gallery, and contact page. I would like to host this website online but I’m not sure of the process to go about getting the project ready for production and deploying it. Ive found plenty online but id really appreciate if any experienced django developer could help me with the process.
/r/django
https://redd.it/12hr76g
Hello,
I have a little experience with Django and Ive recently just finished developing my first solo django project. Its an art website for my dad’s paintings that features a home page, gallery, and contact page. I would like to host this website online but I’m not sure of the process to go about getting the project ready for production and deploying it. Ive found plenty online but id really appreciate if any experienced django developer could help me with the process.
/r/django
https://redd.it/12hr76g
Reddit
r/django on Reddit: Help deploying my first project to production.
Posted by u/ejm55 - 5 votes and 7 comments
Desktop Application
Hello Guys , I Hope You're Doing Well
So i've created this Desktop App Using python , it scraps post titles and post contents from the "techCrunch" Sites ,
its useful for tech content Creators , instead of checking The Site daily all you have is to open the app then select a category " the home page is the default one "
i want you to tell me what do you think about it , how would i improve it ( design , other functions .. etc )
and if you want to try it i'll send you the download link
​
https://reddit.com/link/12ib99c/video/p9fzt6gma7ta1/player
/r/Python
https://redd.it/12ib99c
Hello Guys , I Hope You're Doing Well
So i've created this Desktop App Using python , it scraps post titles and post contents from the "techCrunch" Sites ,
its useful for tech content Creators , instead of checking The Site daily all you have is to open the app then select a category " the home page is the default one "
i want you to tell me what do you think about it , how would i improve it ( design , other functions .. etc )
and if you want to try it i'll send you the download link
​
https://reddit.com/link/12ib99c/video/p9fzt6gma7ta1/player
/r/Python
https://redd.it/12ib99c
Reddit
r/Python on Reddit: Desktop Application
Posted by u/Mr_N_01 - No votes and 8 comments
Flask-SQLAlchemy, how to render supposedly easy query
Hi all,
I'm using SQLAlchemy in flask using flask-sqlalchemy as mostly suggested around the web but i'm facing some issues on basic queries (maybe it's something wrong on the model).
I have this model:
class Event(db.Model):
id = db.Column(db.Integer, primarykey=True)
timestamp = db.Column(db.DateTime(timezone=True),default=datetime.now(),serverdefault=func.now())
date = db.Column(db.Date(),default=datetime.now(),serverdefault=func.now())
environmentid = db.Column(db.Integer, db.ForeignKey('environment.id'))
sourceid = db.Column(db.Integer, db.ForeignKey('source.id'))
releaseid = db.Column(db.Integer, db.ForeignKey('release.id'))
event = db.Column(db.String(200))
def repr(self) -> str:
return '<Event {}:{}>'.format(self.id, self.event)
First issue is that I supposed that "date" field, using (db.Date()) column, would be a date without a time (e.g.: 2023-04-11) while in my database (sqlite3 in my desktop, shall be mysql once put into "production") is still a timestamp (e.g.: 2023-04-11 09:05:13). I Suppose that on mysql this would be rendered correctly?
Second issue, tied to
/r/flask
https://redd.it/12ibss4
Hi all,
I'm using SQLAlchemy in flask using flask-sqlalchemy as mostly suggested around the web but i'm facing some issues on basic queries (maybe it's something wrong on the model).
I have this model:
class Event(db.Model):
id = db.Column(db.Integer, primarykey=True)
timestamp = db.Column(db.DateTime(timezone=True),default=datetime.now(),serverdefault=func.now())
date = db.Column(db.Date(),default=datetime.now(),serverdefault=func.now())
environmentid = db.Column(db.Integer, db.ForeignKey('environment.id'))
sourceid = db.Column(db.Integer, db.ForeignKey('source.id'))
releaseid = db.Column(db.Integer, db.ForeignKey('release.id'))
event = db.Column(db.String(200))
def repr(self) -> str:
return '<Event {}:{}>'.format(self.id, self.event)
First issue is that I supposed that "date" field, using (db.Date()) column, would be a date without a time (e.g.: 2023-04-11) while in my database (sqlite3 in my desktop, shall be mysql once put into "production") is still a timestamp (e.g.: 2023-04-11 09:05:13). I Suppose that on mysql this would be rendered correctly?
Second issue, tied to
/r/flask
https://redd.it/12ibss4
Best practise with django migrations in google cloud run.
Hi folks,
I've got a containerised django app in google cloud run. I've began the process of automating its release using github actions and all is going smoothly, but i've hit a bit of an issue that im not sure on the best practise on. When handling migrations, what would be the best way to do this?
I feel like the way to go is to, once i've deployed the new instance to cloud run, to get the CD pipeline to run `./manage.py migrate`, but i can't find much documentation on whether this is okay. I could also add this to the dockerfile, but i dont really want to be trying to migrate every time google spins up a new instance.
Note that im using a database hosted outside of google due to extensions required that google SQL Cloud doesn't support.
/r/django
https://redd.it/12ibxnq
Hi folks,
I've got a containerised django app in google cloud run. I've began the process of automating its release using github actions and all is going smoothly, but i've hit a bit of an issue that im not sure on the best practise on. When handling migrations, what would be the best way to do this?
I feel like the way to go is to, once i've deployed the new instance to cloud run, to get the CD pipeline to run `./manage.py migrate`, but i can't find much documentation on whether this is okay. I could also add this to the dockerfile, but i dont really want to be trying to migrate every time google spins up a new instance.
Note that im using a database hosted outside of google due to extensions required that google SQL Cloud doesn't support.
/r/django
https://redd.it/12ibxnq
Reddit
r/django on Reddit: Best practise with django migrations in google cloud run.
Posted by u/mudkipfreak - 4 votes and 4 comments
I was working in password reset email by watching some tutorial and I want some help as I entered the email in the form but it doesnt provide me with recovery email
​
https://preview.redd.it/bfgaqyiga8ta1.png?width=1316&format=png&auto=webp&v=enabled&s=97128f5ca6c20b343079b0fe4b88c128346b367f
/r/django
https://redd.it/12ievsv
​
https://preview.redd.it/bfgaqyiga8ta1.png?width=1316&format=png&auto=webp&v=enabled&s=97128f5ca6c20b343079b0fe4b88c128346b367f
/r/django
https://redd.it/12ievsv
Limiting concurrency in Python asyncio: the story of async imap_unordered()
https://death.andgravity.com/limit-concurrency
/r/Python
https://redd.it/12ii45y
https://death.andgravity.com/limit-concurrency
/r/Python
https://redd.it/12ii45y
death and gravity
Limiting concurrency in Python asyncio: the story of async imap_unordered()
So, you're doing some async stuff, repeatedly, hundreds of thousands of times. How do you *not* do it all at once? Hint: asyncio.Semaphore is not always the best way, despite what Stack Overflow may tell you ;)
Track user interactions
I am writing a django app that has staff and client users, I want to be able to track various actions like "Client X filled out Y form" or "Staff X exported Y document" in a live updated feed on my management page. Is there a django package for something like this? If not I'll make it myself - I'm thinking of using HTMX polling.
/r/django
https://redd.it/12iib3c
I am writing a django app that has staff and client users, I want to be able to track various actions like "Client X filled out Y form" or "Staff X exported Y document" in a live updated feed on my management page. Is there a django package for something like this? If not I'll make it myself - I'm thinking of using HTMX polling.
/r/django
https://redd.it/12iib3c
Reddit
r/django on Reddit: Track user interactions
Posted by u/AttractiveCorpse - 5 votes and 3 comments
pytypest: testing framework that empowers pytest (with better fixtures and parametrization)
https://github.com/orsinium-labs/pytypest
/r/Python
https://redd.it/12ii3e0
https://github.com/orsinium-labs/pytypest
/r/Python
https://redd.it/12ii3e0
GitHub
GitHub - orsinium-labs/pytypest: Testing framework that empowers pytest (with better fixtures and parametrization)
Testing framework that empowers pytest (with better fixtures and parametrization) - GitHub - orsinium-labs/pytypest: Testing framework that empowers pytest (with better fixtures and parametrization)
New to django, how to get the url pattern from request in views.py?
Lets say the url is
Ive created the path in urls.py, but how do I get the event-id in views.py? I want to assign that event-id to a variable.
/r/django
https://redd.it/12iiaw1
Lets say the url is
/get-event/{event-id}Ive created the path in urls.py, but how do I get the event-id in views.py? I want to assign that event-id to a variable.
/r/django
https://redd.it/12iiaw1
Reddit
r/django on Reddit: New to django, how to get the url pattern from request in views.py?
Posted by u/SwathedOrange - 5 votes and 15 comments
Using Python and AI to query and ask question about your audio data
Hey there!
After receiving such a warm response to my last tutorial on extending OpenAI with new knowledge, allowing you to ask it anything your heart desires, I'm excited to share a brand new video on querying your audio data! Check it out here: **https://youtu.be/Klf9aIxh1Lc**
In this video, I tackle a super common use case that I bet many of you have faced. Give it a watch, and let me know if you've experienced the same issue!
I hope you enjoy it and find it helpful. But before you dive in, please keep in mind that you'll be sending your data to an API, so it's best not to use private or sensitive information.
Here's the link to the Github Repo for your convenience: **https://github.com/grumpyp/chroma-langchain-tutorial/tree/main/whsiper-langchain-chroma**
Happy learning!
/r/Python
https://redd.it/12ima2b
Hey there!
After receiving such a warm response to my last tutorial on extending OpenAI with new knowledge, allowing you to ask it anything your heart desires, I'm excited to share a brand new video on querying your audio data! Check it out here: **https://youtu.be/Klf9aIxh1Lc**
In this video, I tackle a super common use case that I bet many of you have faced. Give it a watch, and let me know if you've experienced the same issue!
I hope you enjoy it and find it helpful. But before you dive in, please keep in mind that you'll be sending your data to an API, so it's best not to use private or sensitive information.
Here's the link to the Github Repo for your convenience: **https://github.com/grumpyp/chroma-langchain-tutorial/tree/main/whsiper-langchain-chroma**
Happy learning!
/r/Python
https://redd.it/12ima2b
YouTube
Using OpenAI's Whisper API to query your data - Chroma, LangChain, Python - Tutorial
In this tutorial, we will explore how to use OpenAI's Whisper API to query your own data using Chroma and LangChain. To get started, we will build a Python script generate text from our audio data using the Whisper API.
We will then use the OpenAI embeddings…
We will then use the OpenAI embeddings…
[D] "There are substantial innovations that distinguish these three models, but they are almost entirely restricted to infrastructural innovations in high-performance computing rather than model-design work that is specific to language technology." Is this true?
https://arxiv.org/abs/2304.00612
/r/MachineLearning
https://redd.it/12ig4qq
https://arxiv.org/abs/2304.00612
/r/MachineLearning
https://redd.it/12ig4qq
Reddit
r/MachineLearning on Reddit: [D] "There are substantial innovations that distinguish these three models, but they are almost entirely…
Posted by u/pier4r - 38 votes and 5 comments
Is anyone working on edge computing solutions targeting Python?
Many companies are now rolling out their WebAssembly based or isolated V8 edge computing serverless function solutions.
E.g.
[Supabase](https://supabase.com/blog/edge-runtime-self-hosted-deno-functions) (news in today)
Cloudflare
Most of these solutions target TypeScript/JavaScript developers. I wonder if anyone is working on edge computing solution that would target Python as the developer language? Either through WebAssembly compiled (widely supported today) or some specific Python isolation method.
/r/Python
https://redd.it/12im8cx
Many companies are now rolling out their WebAssembly based or isolated V8 edge computing serverless function solutions.
E.g.
[Supabase](https://supabase.com/blog/edge-runtime-self-hosted-deno-functions) (news in today)
Cloudflare
Most of these solutions target TypeScript/JavaScript developers. I wonder if anyone is working on edge computing solution that would target Python as the developer language? Either through WebAssembly compiled (widely supported today) or some specific Python isolation method.
/r/Python
https://redd.it/12im8cx
Supabase
Supabase Edge Runtime: Self-hosted Deno Functions
We are open-sourcing Supabase Edge Runtime allowing you to host your Edge Functions anywhere.
Wakatime with Jupyter (Not in VSCode)
I can see that in wakatime’s leader boards you can sort by “Jupyter”. But I can’t seem to figure out how Wakatime tracks Jupyter if I use Jupyter on a local server outside of VSCode. Any tips?
/r/JupyterNotebooks
https://redd.it/12hnesp
I can see that in wakatime’s leader boards you can sort by “Jupyter”. But I can’t seem to figure out how Wakatime tracks Jupyter if I use Jupyter on a local server outside of VSCode. Any tips?
/r/JupyterNotebooks
https://redd.it/12hnesp
Reddit
r/JupyterNotebooks on Reddit: Wakatime with Jupyter (Not in VSCode)
Posted by u/Normanras - 1 vote and no comments
Introducing Markdown Code Runner: Automatically execute code blocks in your Markdown files! 🚀
Hey r/Python!
I recently developed a Python package called Markdown Code Runner (
GitHub Repository: https://github.com/basnijholt/markdown-code-runner
Key Features:
- Automatically execute code blocks, including hidden code blocks, within a Markdown file
- Allows hidden code blocks to generate content like tables, plots, etc.
- Works with Python and Bash code blocks
- Keeps the output of the code blocks up-to-date
- Easily integrates with GitHub Actions
- No external dependencies and works with Python 3.7+
Why Markdown Code Runner?
When creating Markdown files with code examples, it's essential to keep the output of these code snippets accurate and up-to-date. Manually updating the output can be time-consuming and error-prone, especially when working with large files or multiple collaborators. In addition, there might be cases where hidden code blocks are needed to generate content such as tables, plots, and other visualizations without displaying the code itself in the Markdown file.
/r/Python
https://redd.it/12iupj2
Hey r/Python!
I recently developed a Python package called Markdown Code Runner (
markdown-code-runner) that allows you to automatically execute code blocks within a Markdown file, including hidden code blocks, and updates the output in-place. This can be super useful for maintaining Markdown files with embedded code snippets, ensuring that the output displayed is always up-to-date and accurate. It also enables generating content like tables, plots, and other visualizations directly from the code.GitHub Repository: https://github.com/basnijholt/markdown-code-runner
Key Features:
- Automatically execute code blocks, including hidden code blocks, within a Markdown file
- Allows hidden code blocks to generate content like tables, plots, etc.
- Works with Python and Bash code blocks
- Keeps the output of the code blocks up-to-date
- Easily integrates with GitHub Actions
- No external dependencies and works with Python 3.7+
Why Markdown Code Runner?
When creating Markdown files with code examples, it's essential to keep the output of these code snippets accurate and up-to-date. Manually updating the output can be time-consuming and error-prone, especially when working with large files or multiple collaborators. In addition, there might be cases where hidden code blocks are needed to generate content such as tables, plots, and other visualizations without displaying the code itself in the Markdown file.
markdown-code-runner solves this problem by/r/Python
https://redd.it/12iupj2
GitHub
GitHub - basnijholt/markdown-code-runner: Automatically execute code blocks within a Markdown file and update the output in-place
Automatically execute code blocks within a Markdown file and update the output in-place - basnijholt/markdown-code-runner
New release of FastKafka improves testability
We were searching for something like FastAPI for Kafka-based service we were developing, but couldn’t find anything similar. So we shamelessly made one by reusing beloved paradigms from FastAPI and we shamelessly named it FastKafka. The point was to set the expectations right - you get pretty much what you would expect: function decorators for consumers and producers with type hints specifying Pydantic classes for JSON encoding/decoding, automatic message routing to Kafka brokers and documentation generation.
https://github.com/airtai/fastkafka
The new release adds in-memory Kafka broker that can be used for testing without the need to install Java and start a broker. It allows you to write a simple-to-understand tests such as this one:
/r/Python
https://redd.it/12isl07
We were searching for something like FastAPI for Kafka-based service we were developing, but couldn’t find anything similar. So we shamelessly made one by reusing beloved paradigms from FastAPI and we shamelessly named it FastKafka. The point was to set the expectations right - you get pretty much what you would expect: function decorators for consumers and producers with type hints specifying Pydantic classes for JSON encoding/decoding, automatic message routing to Kafka brokers and documentation generation.
https://github.com/airtai/fastkafka
The new release adds in-memory Kafka broker that can be used for testing without the need to install Java and start a broker. It allows you to write a simple-to-understand tests such as this one:
from fastkafka.testing import Tester
msg = IrisInputData(
sepal_length=0.1,
sepal_width=0.2,
petal_length=0.3,
petal_width=0.4,
)
# Start Tester app and create InMemory Kafka broker for testing
async with Tester(kafka_app) as tester:
# Send IrisInputData message to input_data topic
await tester.to_input_data(msg)
# Assert that the kafka_app responded with IrisPrediction in predictions topic
await tester.awaited_mocks.on_predictions.assert_awaited_with(
IrisPrediction(species="setosa"), timeout=2
)
/r/Python
https://redd.it/12isl07
GitHub
GitHub - airtai/fastkafka: FastKafka is a powerful and easy-to-use Python library for building asynchronous web services that interact…
FastKafka is a powerful and easy-to-use Python library for building asynchronous web services that interact with Kafka topics. Built on top of Pydantic, AIOKafka and AsyncAPI, FastKafka simplifies ...
I used Python to make a BizBuySell web scraper to get businesses for sale in a given state. I used aiohttp to fetch requests asynchronously. The code has a rate limiter as well!
Hey friends! Back again with another python web scraping project.
A founder reached out to me to know if it was possible to scrape BizBuySell for businesses for sale in a specific state. They needed the data for business development. I never scraped this site so I was up for a new challenge.
At first I ran into issues with bot blocking. They use Akamai CDN. However, with a bit more research, I managed to get the data. The site was not too difficult compared to others. No dynamic javascript which means no need to use selenium. I only fetched the first 12 pages to keep the demo short. Happy to answer any web scraping questions.
Youtube demo: How to scrape BizBuySell with Python
Source code on Github: How to scrape BizBuySell with python
/r/Python
https://redd.it/12ixw47
Hey friends! Back again with another python web scraping project.
A founder reached out to me to know if it was possible to scrape BizBuySell for businesses for sale in a specific state. They needed the data for business development. I never scraped this site so I was up for a new challenge.
At first I ran into issues with bot blocking. They use Akamai CDN. However, with a bit more research, I managed to get the data. The site was not too difficult compared to others. No dynamic javascript which means no need to use selenium. I only fetched the first 12 pages to keep the demo short. Happy to answer any web scraping questions.
Youtube demo: How to scrape BizBuySell with Python
Source code on Github: How to scrape BizBuySell with python
/r/Python
https://redd.it/12ixw47
YouTube
I made a web scraper to get all businesses for sale on BizBuySell with Python and aiohttp
Hey friends! Back again with another python web scraping project.
A founder reached out to me to know if it was possible to scrape BizBuySell for businesses for sale in a specific state. They needed the data for business development.
At first I ran into…
A founder reached out to me to know if it was possible to scrape BizBuySell for businesses for sale in a specific state. They needed the data for business development.
At first I ran into…
Nested LDAP groups for Flask not working
Hello!
I am currently using flask_appbuilder.security.manager in order to provide LDAP authentication for my Airflow instance(Version 2.5.0) . When doing the AUTH_ROLES_MAPPING
I have noticed that it only works for direct members of the active directory groups I am calling out. Has anyone been able to get this to work for nested groups?
Example:
in my current set up
AUTH_ROLES_MAPPING =
User A: member of ADMINACTIVEDIRECTORYGROUP
User B: member of ROLEGROUP which is a member of ADMINACTIVEDIRECTORYGROUP
Only User A would be able to login to my airflow instance as Admin since flask is not recognizing nested group membership
I have tried multiple variations of
member:1.2.840.113556.1.4.1941:=
memberof:1.2.840.113556.1.4.1941:=
to no avail.
Thank you for the help or insight if others have gotten nested AD groups working. This would be extremely helpful.
/r/flask
https://redd.it/12ipw2z
Hello!
I am currently using flask_appbuilder.security.manager in order to provide LDAP authentication for my Airflow instance(Version 2.5.0) . When doing the AUTH_ROLES_MAPPING
I have noticed that it only works for direct members of the active directory groups I am calling out. Has anyone been able to get this to work for nested groups?
Example:
in my current set up
AUTH_ROLES_MAPPING =
{"CN=ADMINACTIVEDIRECTORYGROUP,OU=ResourceAirflow,OU=ResourceGroups,OU=!!sample,DC=sample,DC=sample" : ["admin"]User A: member of ADMINACTIVEDIRECTORYGROUP
User B: member of ROLEGROUP which is a member of ADMINACTIVEDIRECTORYGROUP
Only User A would be able to login to my airflow instance as Admin since flask is not recognizing nested group membership
I have tried multiple variations of
member:1.2.840.113556.1.4.1941:=
memberof:1.2.840.113556.1.4.1941:=
to no avail.
Thank you for the help or insight if others have gotten nested AD groups working. This would be extremely helpful.
/r/flask
https://redd.it/12ipw2z
Reddit
r/flask on Reddit: Nested LDAP groups for Flask not working
Posted by u/No_Wasabi2200 - 5 votes and 2 comments
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/12j2rz4
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/12j2rz4
Discord
Join the Python Discord Server!
We're a large community focused around the Python programming language. We believe that anyone can learn to code. | 412982 members
If you're a beginner interested in data science and machine learning, I recently produced a video series that goes through all of the major algorithms and their implementations in Python! I put a lot of work into each tutorial, so hopefully this helps out!
https://www.youtube.com/playlist?list=PLvICEeb-TZEHKkojcv1_POKPrCwlsEnsI
/r/Python
https://redd.it/12j68f7
https://www.youtube.com/playlist?list=PLvICEeb-TZEHKkojcv1_POKPrCwlsEnsI
/r/Python
https://redd.it/12j68f7
Reddit
r/Python on Reddit: If you're a beginner interested in data science and machine learning, I recently produced a video series that…
Posted by u/RohakJain - 105 votes and 8 comments
Python Magic: How to do Screen Recording of a specific window and save it as animated GIF: Code included
Check this out!
https://medium.com/@neonforge/python-magic-how-to-do-screen-recording-of-a-specific-window-and-save-it-as-animated-gif-code-db8406f9aafd
/r/Python
https://redd.it/12j7hci
Check this out!
https://medium.com/@neonforge/python-magic-how-to-do-screen-recording-of-a-specific-window-and-save-it-as-animated-gif-code-db8406f9aafd
/r/Python
https://redd.it/12j7hci
Medium
Python Magic: How to do Screen Recording of a specific window and save it as animated GIF: Code included
Ah, technology! Don’t you just love it when you discover a new trick that makes your life a little bit easier? I know I do. So, let me…