pythondaily | Образование

Telegram-канал pythondaily - Python Daily

1102

Daily Python News Question, Tips and Tricks, Best Practices on Python Programming Language Find more reddit channels over at @r_channels

Подписаться на канал

Python Daily

Lost $25k usd and access to my web app

I have a Django Web Application built on 5.0.6

I was "partnered" with an individual. This individual more or less has stripped me of a little over $25,000 in revenue, has added another developer to the hosting platform (DigitalOcean).

I reached out to DigitalOcean explaining the situation and they said their was nothing they could do without details I don't have access to.

Lesson learned the hard way.

I spent around 9 months building this project from nothing. I have reached out to a lawyer and the lawyer has verified that I do own 100% of it. (I just wanted to be certain.)

I've exhausted every method I know to get administrative access back but I've ran out of options. I created a script in one of the app.py files to create a new user and promote them to superuser. The new developer turned off autodeploy from my repo so I cant modify it the actual django app that is running anymore.

How can I create an admin account without console access?

What should I do?

I've tried everything I know.

Please help.


Update #1

Lawyer said to go ahead and file a DMCA Claim to DO. Lawyer will contacting the parties in the AM. I appreciate everyone's

/r/django
https://redd.it/1ibocln

Читать полностью…

Python Daily

Spend lots of time and effort with this python project. I hope this can be of use to anyone.

https://github.com/irfanbroo/Netwarden

What my project does

What it does is basically captures live
network traffic using Wireshark, analyzing packets for suspicious activity such as malicious DNS queries, potential SYN scans,, and unusually large packets. By integrating Nmap, It also performs vulnerability scans to assess the security of networked systems, helping detect potential threats. I also added netcat, nmap arm spoofing detection etc.

Target audience

This is targeted mainly for security enthusiasts for those people who wants to check their network for any malicious activities

Comparison

I tried to integrate all the features I can find into this one script which can save the hassle of using different services to check for different attacks and malicious activities


I would really appreciate any contributions or help regarding optimising the code further and making it more cleaner. Thanks 👍🏻

/r/Python
https://redd.it/1ibg5co

Читать полностью…

Python Daily

Question about implementation of sending emails

I'm creating a web application following Miguel's mega-tutorial.
I'm on lesson 7 and I've encountered a problem: for some reason, despite having intentionally caused an error in my site, no message appears in the second terminal where aiosmtpd is running.
I don't understand why nothing appears. These are my bits of code that I used to try to make this stuff work:

in config file:

import os

basedir = os.path.abspath(os.path.dirname(__file__))  # Questa variabile immagazzina il percorso della directory principale sottoforma di stringa

class Config:
    SECRET_KEY = os.environ.get('SECRET_KEY') or b'mykey'
    SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or \
        'sqlite:///' + os.path.join(basedir, 'app.db')
   
    MAIL_SERVER = os.environ.get('MAIL_SERVER')
    MAIL_PORT = int(os.environ.get('MAIL_PORT') or 25)
    MAIL_USE_TLS = os.environ.get('MAIL_USE_TLS') is not None
    MAIL_USERNAME = os.environ.get('MAIL_USERNAME')
    MAIL_PASSWORD = os.environ.get('MAIL_PASSWORD')
    ADMINS = ['mymail@example.com']


in init file:



/r/flask
https://redd.it/1ibjlyy

Читать полностью…

Python Daily

Course to learn Django

I'd like to learn Django.

I already use Python.

I was considering the Udemy course by Jose Portilla Django 4 and Python Full-Stack Developer Masterclass

What do you think?

/r/djangolearning
https://redd.it/1iba6hp

Читать полностью…

Python Daily

Multicharting + Live Streaming Tool for IBKR

# What My Project Does

It's finally here! I set out on my journey on Python 4 years to one day create my own trading/charting tool. Now, I am sharing this dashboard that has been an on-off project along this journey. It comes together with the following features:

* Live data, together with candlestick charting thats updated on intervals.
* Multi-charting functionalities, up to 6 charts per screen (you can open multiple tabs).
* In the home page, a built in Bloomberg news stream.
* Ticker search functionalities on IBKR offerings.
* Indicators in Typescript, and can be added on to in the code.

For now, the project data streams only caters to IBKR, which is what I am using primarily. Hopefully through this post, I can find contributors much more talented than me (which I am sure most of you are) to work together and continue making improvements this project. The main goal to continue to work towards making a non-paywalled, high-quality analytics completely open source.

Thank you for taking the time to read this, and you can check out the project here: [https://github.com/lvxhnat/ibkr-charts](https://github.com/lvxhnat/ibkr-charts) :)

# Target Audience

Engineers / developers with IBKR accounts interested in trading/investments.

# Comparison

I am not aware of any other open source tools that connects to

/r/Python
https://redd.it/1ibbbib

Читать полностью…

Python Daily

what happened to 'djang road' the youtuber???

do you guys know about the youtuber name django road? all of sudden, she disappeared.. her channel is gone.. what happen??

/r/django
https://redd.it/1ib53ov

Читать полностью…

Python Daily

Need Design Suggestions for My Django App Dashboards

Hi guys,

I have a simple setup with a regular user and superuser dashboard:

If you log in with regular user credentials, you’re taken to the regular user dashboard, where you can view the "mailing list" from a PostgreSQL database.
If you log in as a superuser, you’ll be taken to the Super User Dashboard, where you can CRUD the mailing list from the same PostgreSQL database.

The problem now is the design of the dashboards, login, and signup pages. I’ve mostly used a template from Bootstrap (CSS and JavaScript), Google Fonts, static CSS, and style.css.

My boss wants the web app to have a "professional" or "client-ready" look.

Can you suggest any designs or templates I can easily integrate into my web application?

Thanks in advance!

Here is the sample interface:

Login Screen

Sign-Up Screen

Super User Dashboard

User Management \(Where the super users can see all the users and can edit\/delete users and also their recent action logs are shown

Regular User Dashboard \(where the regular users can see the mailing list and generate report via \(CSV\/PDF file\)



/r/django
https://redd.it/1iayme6

Читать полностью…

Python Daily

Flask-alchemy create Models

Hey Guys and Girls,

I´m wondering about a lot over Tutorials. I´m workin on my first little Flask Web App. I´m a student for Media Tech with intermediate or better good understanding whatsoever.

In many Tutorials this "Mapped" SQLALchemy 2.0 style just does not exist. Why is that? Is there any big difference?

The SQL ALchemy Tutorial tells me to use that style over the old style... I dont get it.

Or it is like Flask-alchemy is using the old style?

# SQL ALCHEMY 2.0 STYLE

class Base(DeclarativeBase):
    pass

db = SQLAlchemy(modelclass=Base)

class Sailor(Base):
    tablename = 'sailor'
    id: Mapped[int] = mapped
column(primarykey=True)
    username: Mapped[str] = mapped
column(String(50), nullable=False)
    password: Mappedstr = mappedcolumn(String(50), nullable=False)

#S SQL ALCHEMY OLD STYLE

class Sailor(db.base):
tablename = 'sailor'
id = db.Column(db.Integer, primary
key =

/r/flask
https://redd.it/1iac4im

Читать полностью…

Python Daily

How do I host flask web application on ubuntu VPS? (hostinger)?

recently i purchased a vps from hostinger but unfortunately there's no support for python flask but it allows various apps, panels, and plain OS as well. but i genuinely don't know what I'm doing. and I do want to connect a custom domain as well.

/r/flask
https://redd.it/1iao8zo

Читать полностью…

Python Daily

Django e-commerce

In the past couple of months, i have been updating my Django e-commerce project and would love to share.

It mainly involves utilizing Django template, DigitalOcean, Whitenoise for static files, and Azure for PostgreSQL, and Azure Blob Storage for handling media only

https://voxmart.co.tz/


/r/django
https://redd.it/1ia59ga

Читать полностью…

Python Daily

D Simple Questions Thread

Please post your questions here instead of creating a new thread. Encourage others who create new posts for questions to post here instead!

Thread will stay alive until next one so keep posting after the date in the title.

Thanks to everyone for answering questions in the previous thread!

/r/MachineLearning
https://redd.it/1iai5g6

Читать полностью…

Python Daily

Currex - Pythonic currency calculator with exchange rates

Repo: [https://github.com/stared/currex](https://github.com/stared/currex)
Demo: [try in Google Colab without installing anything](https://colab.research.google.com/github/stared/currex/blob/main/currex.ipynb)

I often use Python as a command-line calculator. However, I frequently found myself going back to Google Search to convert between currencies. So, I created this library to make adding, multiplying, and converting between currencies easy. One of its core features is autocasting - when working with multiple currencies, it automatically converts them to match the first currency used.

# What My Project Does

Currex is a Pythonic currency calculator that makes working with currencies and exchange rates simple and smooth. It allows you to:

- Add, subtract, multiply, and divide currencies as if they were numbers
- Easily convert between currencies (e.g., USD to EUR)
- Autocast when mixing multiple currencies (they automatically convert to the first currency referenced)
- Fetch exchange rates from [HexaRate](https://hexarate.paikama.co/) in real-time

Here's a simple example:

```python
from currex import *

# use currencies as if they were numbers
100 * USD # USD(100.00)
12 * USD(100) # USD(1200.00)

# convert currencies to other currencies
USD(100).to(EUR) # EUR(85.30)
USD(100).to(PLN) # PLN(430.50)

# this syntax is also supported
PLN(EUR(12)) # PLN(51.33)


/r/Python
https://redd.it/1i9sn69

Читать полностью…

Python Daily

Sunday Daily Thread: What's everyone working on this week?

# Weekly Thread: What's Everyone Working On This Week? 🛠️

Hello /r/Python! It's time to share what you've been working on! Whether it's a work-in-progress, a completed masterpiece, or just a rough idea, let us know what you're up to!

## How it Works:

1. Show & Tell: Share your current projects, completed works, or future ideas.
2. Discuss: Get feedback, find collaborators, or just chat about your project.
3. Inspire: Your project might inspire someone else, just as you might get inspired here.

## Guidelines:

Feel free to include as many details as you'd like. Code snippets, screenshots, and links are all welcome.
Whether it's your job, your hobby, or your passion project, all Python-related work is welcome here.

## Example Shares:

1. Machine Learning Model: Working on a ML model to predict stock prices. Just cracked a 90% accuracy rate!
2. Web Scraping: Built a script to scrape and analyze news articles. It's helped me understand media bias better.
3. Automation: Automated my home lighting with Python and Raspberry Pi. My life has never been easier!

Let's build and grow together! Share your journey and learn from others. Happy coding! 🌟

/r/Python
https://redd.it/1ia0tm7

Читать полностью…

Python Daily

Help Needed: Unable to Update Field Values in Web App (304 Not Modified Issue)

Hi All,

Hi everyone,
I'm working on a small project involving web application development. While I can successfully create records for users, I'm running into trouble updating field values. Every time I try to update, I encounter a 304 Not Modified status response.

I suspect there's something wrong in my code or configuration, but I can't pinpoint the exact issue.

Here’s what I’d like help with:

Understanding why I might be receiving a `304 Not Modified` status.
Identifying the part of the code I should focus on (frontend or backend).

Below is a brief overview of the technologies I’m using and relevant details:

Frontend: \[HTML, CSS, JavaSCript\]
Backend: [Python\]
Database: \[SQLAlchemy, MySQL\]
HTTP Method for Update: POST, GET
Error Details:
127.0.0.1 \- - [25/Jan/2025 12:03:07\] "GET /static/css/style.css HTTP/1.1" 304 -
[127.0.0.1](http://127.0.0.1) \- - \[25/Jan/2025 12:03:07\] "GET /static/js/profile\_details.js HTTP/1.1" 304 -
127.0.0.1 \- - [25/Jan/2025 12:03:07\] "GET /static/images/default_placeholder.png HTTP/1.1" 304 -
[127.0.0.1](http://127.0.0.1) \- - \[25/Jan/2025 12:03:07\] "GET /static/js/calendar\_availability.js HTTP/1.1" 304 -
127.0.0.1 \- - [25/Jan/2025 12:03:23\] "GET /static/css/style.css HTTP/1.1" 304 -

I’d appreciate any guidance or suggestions. If needed, I can share snippets of the relevant code. Thank you in

/r/flask
https://redd.it/1i9uqpw

Читать полностью…

Python Daily

Understanding .get vs get_object_or_404 in Django
https://www.youtube.com/watch?v=J7r5K5kLGWY&t=281s

/r/django
https://redd.it/1i9xvlm

Читать полностью…

Python Daily

Google Search introduced JavaScript

Has anyone figured out how to get data from the first page of Google search results now? Selenium?
BeautifulSoup seemed to do the job just fine (like getting headers of search results).
Now apparently a bare minimum would be Selenium to mimic user interface interaction.
But it still don't seem to accomplish that.
Although this is introduced:
driver.implicitly_wait(30)
and
profile.set_preference("javascript.enabled", True)

Overall it looks something like
profile = webdriver.FirefoxProfile()
profile.set_preference("general.useragent.override", "Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/38.0")
profile.set_preference("javascript.enabled", True)
broswer = webdriver.Firefox(profile)
broswer.get('https://Google.xyz xyz xyz')
driver.implicitly_wait(1000)

soup = BeautifulSoup(driver.page_source,'html.parser')
print(soup)

Is that suffice? Or supposed to be suffice?

/r/Python
https://redd.it/1ibu91r

Читать полностью…

Python Daily

Tuesday Daily Thread: Advanced questions

# Weekly Wednesday Thread: Advanced Questions 🐍

Dive deep into Python with our Advanced Questions thread! This space is reserved for questions about more advanced Python topics, frameworks, and best practices.

## How it Works:

1. **Ask Away**: Post your advanced Python questions here.
2. **Expert Insights**: Get answers from experienced developers.
3. **Resource Pool**: Share or discover tutorials, articles, and tips.

## Guidelines:

* This thread is for **advanced questions only**. Beginner questions are welcome in our [Daily Beginner Thread](#daily-beginner-thread-link) every Thursday.
* Questions that are not advanced may be removed and redirected to the appropriate thread.

## Recommended Resources:

* If you don't receive a response, consider exploring r/LearnPython or join the [Python Discord Server](https://discord.gg/python) for quicker assistance.

## Example Questions:

1. **How can you implement a custom memory allocator in Python?**
2. **What are the best practices for optimizing Cython code for heavy numerical computations?**
3. **How do you set up a multi-threaded architecture using Python's Global Interpreter Lock (GIL)?**
4. **Can you explain the intricacies of metaclasses and how they influence object-oriented design in Python?**
5. **How would you go about implementing a distributed task queue using Celery and RabbitMQ?**
6. **What are some advanced use-cases for Python's decorators?**
7. **How can you achieve real-time data streaming in Python with WebSockets?**
8. **What are the

/r/Python
https://redd.it/1ibo7qe

Читать полностью…

Python Daily

How to build AI Agents with Django

I have written an article on how to build AI Agents with Django using Celery and redis as a broker. I explain how to communicate with a frontend server in real time with channels (websockets)

cubode/how-to-build-ai-agents-with-django-5abf1b228e00">cubode/how-to-build-ai-agents-with-django-5abf1b228e00" rel="nofollow">https://medium.com/@cubode/how-to-build-ai-agents-with-django-5abf1b228e00

Hope you enjoy it :) Ask me if you would like something more detailed

/r/django
https://redd.it/1ib7xht

Читать полностью…

Python Daily

Flask syntax error

https://preview.redd.it/s3emc8ibxkfe1.png?width=944&format=png&auto=webp&s=bd3fe88d17a5b92f015fc0d99f165f34f877fe3d

This error ocuur when i try to run my code . can any one explain where is the problem and how to fix,please?

/r/flask
https://redd.it/1ibg7ds

Читать полностью…

Python Daily

Monday Daily Thread: Project ideas!

# Weekly Thread: Project Ideas 💡

Welcome to our weekly Project Ideas thread! Whether you're a newbie looking for a first project or an expert seeking a new challenge, this is the place for you.

## How it Works:

1. **Suggest a Project**: Comment your project idea—be it beginner-friendly or advanced.
2. **Build & Share**: If you complete a project, reply to the original comment, share your experience, and attach your source code.
3. **Explore**: Looking for ideas? Check out Al Sweigart's ["The Big Book of Small Python Projects"](https://www.amazon.com/Big-Book-Small-Python-Programming/dp/1718501242) for inspiration.

## Guidelines:

* Clearly state the difficulty level.
* Provide a brief description and, if possible, outline the tech stack.
* Feel free to link to tutorials or resources that might help.

# Example Submissions:

## Project Idea: Chatbot

**Difficulty**: Intermediate

**Tech Stack**: Python, NLP, Flask/FastAPI/Litestar

**Description**: Create a chatbot that can answer FAQs for a website.

**Resources**: [Building a Chatbot with Python](https://www.youtube.com/watch?v=a37BL0stIuM)

# Project Idea: Weather Dashboard

**Difficulty**: Beginner

**Tech Stack**: HTML, CSS, JavaScript, API

**Description**: Build a dashboard that displays real-time weather information using a weather API.

**Resources**: [Weather API Tutorial](https://www.youtube.com/watch?v=9P5MY_2i7K8)

## Project Idea: File Organizer

**Difficulty**: Beginner

**Tech Stack**: Python, File I/O

**Description**: Create a script that organizes files in a directory into sub-folders based on file type.

**Resources**: [Automate the Boring Stuff: Organizing Files](https://automatetheboringstuff.com/2e/chapter9/)

Let's help each other grow. Happy

/r/Python
https://redd.it/1iaug3w

Читать полностью…

Python Daily

Looking for some advice!

Finished a python tech degree with TeamTreehouse and then went on to do a course from Dennis Ivy on the django framework... Since then have built my own little project and launced it on heroku. Previous to this I was doing a FEWD course but decided that it wasn't really my forte.. I mean it would be alright to have to do a bit of it here and there if I was working on a team and noticed something wasn't jiving but ALL day long I would prefer not to be doing design.. My question is this.. I know we have all had imposture syndrome at some point.. I have been doing this off and on now learning for lets say a year and I am wondering where does one even look for a django job! Or how would you reccomend to start? Really and truly at this point I would love to do an internship and be a part of a team or work on a project with a community but every time I go looking for jobs or internships it seems not many people specify django in their posting... Should I be branching off and learning something else?

/r/django
https://redd.it/1iar3rh

Читать полностью…

Python Daily

Question about an unexpected error

I'm creating a flask app following the flask-mega-tutorial of Miguel. I'm at the seven chapter (but i skipped the six one because i thught that was useless for my purpose). I tried to run the app but i receive this error:
ImportError: cannot import name 'errors' from partially initialized module 'app' (most likely due to a circular import) (C:\\Users\\myuser\\OneDrive\\Desktop\\microblog\\app\\__init__.py)

This is the line code that receives the error: from app import routes, models, errors

Why doesn't it work in my program but in the tutorial it does?

/r/flask
https://redd.it/1iai0oh

Читать полностью…

Python Daily

Django, Postgres, and Pytest

Apologies for the rather basic question, but I'm developing an app locally and have just switched from sqlite to postgres. The database for the app is working fine, but not so the temporary database that Pytest (or unittest) sets up. I keep getting errors like this: 'django.db.utils.ProgrammingError: relation "users_customuser" does not exist', which suggests that the tables in the test DB are not being created correctly. I've tried mucking around with migrations, and the USER permissions for the test DB appear appropriate (though by no means do I have a lot of expertise with postgres). I'm wondering if anyone knows the answer to this, or is aware of some kind of resource or tutorial out there that focuses on the intersection of Django, postgres, and testing?



/r/django
https://redd.it/1iatk98

Читать полностью…

Python Daily

I have been enjoying django these months

I researched the suitable stack to use before working on the product idea in mind, some folks crucified Django while others praised it. But learning to know of some major tech coys using Django is some relief.

We built a mentee meet mentor app for data & AI folks purely on Django at the backend and it has been fun. Though I want to improve API response time in deployment, I'm good outside that. https://semis.reispartechnologies.com/. Mentors can host group sessions and share their profiles for folks to connect with them.

Django at the backend is great, our app has evolved and will still do. Currently, we vet mentors before accepting. We are not there yet obviously, it's a learning experience for me. . Thank you Python & Django :)

/r/django
https://redd.it/1iaon81

Читать полностью…

Python Daily

Deploying Django and Wagtail on Cloud Servers: A Step-by-Step Guide

🚀 Are you struggling to deploy your Django or Wagtail projects on cloud servers like AWS, DigitalOcean, or Hetzner? I’ve been there too, which is why I’ve documented the entire process to help others simplify their deployment journey!

I’m excited to share two repositories that provide comprehensive deployment guides:

1️⃣ Django Deployment on Hetzner (and similar cloud servers):
🔗 GitHub: Django Hetzner Deployment

2️⃣ Wagtail Deployment on Hetzner (and similar cloud servers):
🔗 GitHub: Wagtail Hetzner Deployment

These repositories include:
✅ Setting up your server environment
✅ Installing necessary dependencies (e.g., Docker, PostgreSQL)
✅ Configuring Nginx and Gunicorn for production
✅ Tips for handling static and media files
✅ Streamlined deployment steps

Whether you’re hosting on AWS, DigitalOcean, Hetzner, or another provider, the principles outlined here can be easily adapted to fit your setup.

💡 Why I created this:
I wanted to make it easier for developers to deploy their projects without running into unnecessary roadblocks. If you’re new to cloud hosting or looking for a practical guide, this documentation might be just what you need.

I’d love to hear your feedback or suggestions for improvement. Let me know if these guides help you, or feel free to contribute

/r/django
https://redd.it/1iaa8om

Читать полностью…

Python Daily

Best AI for python programming?

I've been using Chatgpt, but it isn't up to the mark. Like it can code but when I prompt it to code without this module/function, it fails most of the time. Would love to get to know which AI does the best.



/r/Python
https://redd.it/1iabwj1

Читать полностью…

Python Daily

A technical intro to Ibis: The portable Python DataFrame library

We recently explored Ibis, a Python library designed to simplify working with data across multiple storage systems and processing engines. It provides a DataFrame-like API, similar to Pandas, but translates Python operations into backend-specific queries. This allows it to work with SQL databases, analytical engines like BigQuery and DuckDB, and even in-memory tools like Pandas. By acting as a middle layer, Ibis addresses challenges like fragmented storage, scalability, and redundant logic, enabling a more consistent and efficient approach to multi-backend data workflows. Wrote up some learnings here: https://blog.structuredlabs.com/p/a-technical-intro-to-ibis-the-portable?r=4pzohi&utm\_campaign=post&utm\_medium=web&showWelcomeOnShare=false

/r/Python
https://redd.it/1ia1gjx

Читать полностью…

Python Daily

Possibility of Django being helpful to land a job

Hey guys I am an aspiring software engineer who has made and launched a live website using Django. I really like Django but I don’t see that many career opportunities that Django can give me, so I am thinking if I should focus on data science/analytics. What are your honest thoughts about this?

/r/django
https://redd.it/1ia5gbk

Читать полностью…

Python Daily

Django Tutorial Help

https://redd.it/1i9x84m
@pythondaily

Читать полностью…

Python Daily

For my Textual users! Neovim plugin to support Textual CSS Syntax Highlighting

Here's the GitHub repo

Added support for all the same rules as seen in the VSCode Extension for Textual CSS. Hope it's of use to anyone!

/r/Python
https://redd.it/1i9stwk

Читать полностью…
Подписаться на канал