Searchable Input/Combobox For a Form
I'm trying to build a Django application using Django templates, HTMX, Tailwind and Alpine.js.
I've hit a bit of a roadblock trying to create a foreign key selection box that acts like an autocompleting text input/combobox. I want to use this method of input in many places throughout my app as I plan to use it for searching for products, for example, when creating an invoice.
I had a look at select2, and the related django autocomplete light, but struggled to get either to behave exactly in the way I was aiming for, ie as a text input box that shows the filtered options below, instead of as combobox that needs to be selected which then has a search box at the top,
I have modified an Alpine UI combobox component to pull the information from a json returning view which filters and displays the name of objects from one of my models, and then also stores the id in a hidden field on my form. I'm a worried that this method is not very robust and could be hard to test, potentially displaying one piece of data while storing the key of another.
Is there a best practice approach to creating something like
/r/django
https://redd.it/1ebfpr5
I'm trying to build a Django application using Django templates, HTMX, Tailwind and Alpine.js.
I've hit a bit of a roadblock trying to create a foreign key selection box that acts like an autocompleting text input/combobox. I want to use this method of input in many places throughout my app as I plan to use it for searching for products, for example, when creating an invoice.
I had a look at select2, and the related django autocomplete light, but struggled to get either to behave exactly in the way I was aiming for, ie as a text input box that shows the filtered options below, instead of as combobox that needs to be selected which then has a search box at the top,
I have modified an Alpine UI combobox component to pull the information from a json returning view which filters and displays the name of objects from one of my models, and then also stores the id in a hidden field on my form. I'm a worried that this method is not very robust and could be hard to test, potentially displaying one piece of data while storing the key of another.
Is there a best practice approach to creating something like
/r/django
https://redd.it/1ebfpr5
Reddit
From the django community on Reddit
Explore this post and more from the django community
Django Docker tutorials for multiple services
I've been learning about Docker and how to deploy a Django app. I've done multiple tutorials on how to run Celery, Redis, Postgres, etc. However, none of them seem to show how to run all these services together.
Any suggestion for tutorials showing a full start to finish dockerized application and deployed with Celery, Redis and Postgres?
Thanks in advance.
/r/django
https://redd.it/1ebdvbr
I've been learning about Docker and how to deploy a Django app. I've done multiple tutorials on how to run Celery, Redis, Postgres, etc. However, none of them seem to show how to run all these services together.
Any suggestion for tutorials showing a full start to finish dockerized application and deployed with Celery, Redis and Postgres?
Thanks in advance.
/r/django
https://redd.it/1ebdvbr
Reddit
From the django community on Reddit
Explore this post and more from the django community
My first open-source Django & DRF backend. Ask me anything!
https://github.com/sticknet/sticknet-engine
/r/django
https://redd.it/1ebmwxc
https://github.com/sticknet/sticknet-engine
/r/django
https://redd.it/1ebmwxc
GitHub
GitHub - sticknet/sticknet-engine: Backend System for Sticknet - Web3 Social Storage
Backend System for Sticknet - Web3 Social Storage. Contribute to sticknet/sticknet-engine development by creating an account on GitHub.
Tracking user status in Flask
Hi everyone,
I am trying to implement user status(Online/Offline) tracking functionality in my Flask app. I have something, partially working, but is not polished and working as I need. In short, I want to be able to track the Online users, when user login his status updates to Online, respectively when the user logouts his status in the database changes to Offline and the last\_status\_update field(datetime) updates as well with the current timestamp. I have achieved that using SocketIO and it's working perfectly fine, but the user status updates to Offline only if he is using the Logout button which basically ends the session.
I would like to improve that functionality by updating his status if the user closes the tab or the browser, I guess that involves some kind of client-side script, but I can't make it work as i need. Any hints how I can implement the entire functionality? I know that the code is a bit messy, I accept critics and proposals how to modify the entire logic.
The config class and the sockets:
class Config:
SECRET_KEY = os.getenv('SECRET_KEY')
SQLALCHEMY_DATABASE_URI = os.getenv('SQLALCHEMY_DATABASE_URI_DEV')
/r/flask
https://redd.it/1ebbu23
Hi everyone,
I am trying to implement user status(Online/Offline) tracking functionality in my Flask app. I have something, partially working, but is not polished and working as I need. In short, I want to be able to track the Online users, when user login his status updates to Online, respectively when the user logouts his status in the database changes to Offline and the last\_status\_update field(datetime) updates as well with the current timestamp. I have achieved that using SocketIO and it's working perfectly fine, but the user status updates to Offline only if he is using the Logout button which basically ends the session.
I would like to improve that functionality by updating his status if the user closes the tab or the browser, I guess that involves some kind of client-side script, but I can't make it work as i need. Any hints how I can implement the entire functionality? I know that the code is a bit messy, I accept critics and proposals how to modify the entire logic.
The config class and the sockets:
class Config:
SECRET_KEY = os.getenv('SECRET_KEY')
SQLALCHEMY_DATABASE_URI = os.getenv('SQLALCHEMY_DATABASE_URI_DEV')
/r/flask
https://redd.it/1ebbu23
Reddit
From the flask community on Reddit
Explore this post and more from the flask community
Thursday Daily Thread: Python Careers, Courses, and Furthering Education!
# Weekly Thread: Professional Use, Jobs, and Education 🏢
Welcome to this week's discussion on Python in the professional world! This is your spot to talk about job hunting, career growth, and educational resources in Python. Please note, this thread is not for recruitment.
---
## How it Works:
1. Career Talk: Discuss using Python in your job, or the job market for Python roles.
2. Education Q&A: Ask or answer questions about Python courses, certifications, and educational resources.
3. Workplace Chat: Share your experiences, challenges, or success stories about using Python professionally.
---
## Guidelines:
- This thread is not for recruitment. For job postings, please see r/PythonJobs or the recruitment thread in the sidebar.
- Keep discussions relevant to Python in the professional and educational context.
---
## Example Topics:
1. Career Paths: What kinds of roles are out there for Python developers?
2. Certifications: Are Python certifications worth it?
3. Course Recommendations: Any good advanced Python courses to recommend?
4. Workplace Tools: What Python libraries are indispensable in your professional work?
5. Interview Tips: What types of Python questions are commonly asked in interviews?
---
Let's help each other grow in our careers and education. Happy discussing! 🌟
/r/Python
https://redd.it/1ebgo2f
# Weekly Thread: Professional Use, Jobs, and Education 🏢
Welcome to this week's discussion on Python in the professional world! This is your spot to talk about job hunting, career growth, and educational resources in Python. Please note, this thread is not for recruitment.
---
## How it Works:
1. Career Talk: Discuss using Python in your job, or the job market for Python roles.
2. Education Q&A: Ask or answer questions about Python courses, certifications, and educational resources.
3. Workplace Chat: Share your experiences, challenges, or success stories about using Python professionally.
---
## Guidelines:
- This thread is not for recruitment. For job postings, please see r/PythonJobs or the recruitment thread in the sidebar.
- Keep discussions relevant to Python in the professional and educational context.
---
## Example Topics:
1. Career Paths: What kinds of roles are out there for Python developers?
2. Certifications: Are Python certifications worth it?
3. Course Recommendations: Any good advanced Python courses to recommend?
4. Workplace Tools: What Python libraries are indispensable in your professional work?
5. Interview Tips: What types of Python questions are commonly asked in interviews?
---
Let's help each other grow in our careers and education. Happy discussing! 🌟
/r/Python
https://redd.it/1ebgo2f
Reddit
From the Python community on Reddit
Explore this post and more from the Python community
A simple Python script that sorts your ~/Downloads folder by file extensions
Hey everyone!
So I’ve created a very simple Python script to de-clutter your Downloads folder.
demo
# What My Project Does
This Python script sorts the files into different folders such as Audio, Video, Documents etc. according to the file extension. For example, a .pdf file will be moved to Documents.
# Usage
1. Install it through Pip:
2. Run
# Target Audience
Just a useful tool for most people.
# Comparison
Supports a wide range of extensions, easily accessible through a single command, colored logging.
# Links
Source Code (Github)
Python package: PyPi
/r/Python
https://redd.it/1ebq2b3
Hey everyone!
So I’ve created a very simple Python script to de-clutter your Downloads folder.
demo
# What My Project Does
This Python script sorts the files into different folders such as Audio, Video, Documents etc. according to the file extension. For example, a .pdf file will be moved to Documents.
# Usage
1. Install it through Pip:
pip install download-organizer2. Run
$ dlorg to run the script.# Target Audience
Just a useful tool for most people.
# Comparison
Supports a wide range of extensions, easily accessible through a single command, colored logging.
# Links
Source Code (Github)
Python package: PyPi
/r/Python
https://redd.it/1ebq2b3
Introducing Lambda Forge: Simplify Your AWS Lambda Development
Hello Python and Open Source Enthusiasts!
I'm excited to introduce [Lambda Forge\](https://docs.lambda-forge.com/home/getting-started/), a Python framework designed to make AWS Lambda function creation and deployment effortless. Whether you're a seasoned developer or just starting with serverless architectures, Lambda Forge has something to offer.
---
### What My Project Does
Lambda Forge simplifies the process of creating, deploying, and managing AWS Lambda functions. It provides a robust CLI tool to generate Lambda function templates, authorizers, and service integrations with ease. The framework supports live development, allowing developers to test and debug Lambda functions locally while connected to real AWS resources. Additionally, Lambda Forge facilitates the creation and deployment of Lambda Layers, and it automatically generates documentation and architecture diagrams for your projects.
---
### Target Audience
Lambda Forge is designed for developers who are building serverless applications using AWS Lambda. Whether you're working on production-grade applications or experimenting with serverless technologies, Lambda Forge provides the tools and structure to streamline your development workflow. It's suitable for both experienced developers looking for efficiency and newcomers seeking an easy entry point into serverless development.
---
### Key Features:
**1. CLI Tool:**
Lambda Forge includes a powerful CLI tool, `FORGE`, to help you create and manage serverless projects efficiently.
**2. Modular Functions:**
Easily create Lambda functions
/r/Python
https://redd.it/1ebkzfd
Hello Python and Open Source Enthusiasts!
I'm excited to introduce [Lambda Forge\](https://docs.lambda-forge.com/home/getting-started/), a Python framework designed to make AWS Lambda function creation and deployment effortless. Whether you're a seasoned developer or just starting with serverless architectures, Lambda Forge has something to offer.
---
### What My Project Does
Lambda Forge simplifies the process of creating, deploying, and managing AWS Lambda functions. It provides a robust CLI tool to generate Lambda function templates, authorizers, and service integrations with ease. The framework supports live development, allowing developers to test and debug Lambda functions locally while connected to real AWS resources. Additionally, Lambda Forge facilitates the creation and deployment of Lambda Layers, and it automatically generates documentation and architecture diagrams for your projects.
---
### Target Audience
Lambda Forge is designed for developers who are building serverless applications using AWS Lambda. Whether you're working on production-grade applications or experimenting with serverless technologies, Lambda Forge provides the tools and structure to streamline your development workflow. It's suitable for both experienced developers looking for efficiency and newcomers seeking an easy entry point into serverless development.
---
### Key Features:
**1. CLI Tool:**
Lambda Forge includes a powerful CLI tool, `FORGE`, to help you create and manage serverless projects efficiently.
**2. Modular Functions:**
Easily create Lambda functions
/r/Python
https://redd.it/1ebkzfd
Reddit
From the Python community on Reddit
Explore this post and more from the Python community
pgmq-sqlalchemy - Postgres Message Queue Python client that using SQLAlchemy ORM
# [pgmq-sqlalchemy](https://github.com/jason810496/pgmq-sqlalchemy)
# What My Project Does
A more flexible [PGMQ Postgres extension](https://github.com/tembo-io/pgmq) Python client using **SQLAlchemy ORM**, supporting both **async** and **sync** `engines`, `sessionmakers`, or built from `dsn`.
# Comparison
* The [official PGMQ package](https://github.com/tembo-io/pgmq) only supports `psycopg3` DBAPIs.
* For most use cases, using `SQLAlchemy` ORM as the PGMQ client is more flexible, as most Python backend developers won't directly use Python Postgres DBAPIs.
# Features
* Supports **async** and **sync** `engines` and `sessionmakers`, or built from `dsn`.
* **Automatically** creates the `pgmq` (or `pg_partman`) extension on the database if it does not exist.
* Supports **all Postgres DBAPIs supported by SQLAlchemy**, e.g., `psycopg`, `psycopg2`, `asyncpg`.
* See [SQLAlchemy Postgresql Dialects](https://docs.sqlalchemy.org/en/20/dialects/postgresql.html) for all dialects.
# Target Audience
[pgmq-sqlalchemy](https://github.com/jason810496/pgmq-sqlalchemy) is a production package that can be used in scenarios that need a message queue for general fan-out systems or third-party dependencies retry mechanisms.
# Links
* [PyPI](https://pypi.org/project/pgmq-sqlalchemy/)
* [GitHub](https://github.com/jason810496/pgmq-sqlalchemy)
* [Documentation](https://pgmq-sqlalchemy.readthedocs.io/en/latest/)
/r/Python
https://redd.it/1ebvafo
# [pgmq-sqlalchemy](https://github.com/jason810496/pgmq-sqlalchemy)
# What My Project Does
A more flexible [PGMQ Postgres extension](https://github.com/tembo-io/pgmq) Python client using **SQLAlchemy ORM**, supporting both **async** and **sync** `engines`, `sessionmakers`, or built from `dsn`.
# Comparison
* The [official PGMQ package](https://github.com/tembo-io/pgmq) only supports `psycopg3` DBAPIs.
* For most use cases, using `SQLAlchemy` ORM as the PGMQ client is more flexible, as most Python backend developers won't directly use Python Postgres DBAPIs.
# Features
* Supports **async** and **sync** `engines` and `sessionmakers`, or built from `dsn`.
* **Automatically** creates the `pgmq` (or `pg_partman`) extension on the database if it does not exist.
* Supports **all Postgres DBAPIs supported by SQLAlchemy**, e.g., `psycopg`, `psycopg2`, `asyncpg`.
* See [SQLAlchemy Postgresql Dialects](https://docs.sqlalchemy.org/en/20/dialects/postgresql.html) for all dialects.
# Target Audience
[pgmq-sqlalchemy](https://github.com/jason810496/pgmq-sqlalchemy) is a production package that can be used in scenarios that need a message queue for general fan-out systems or third-party dependencies retry mechanisms.
# Links
* [PyPI](https://pypi.org/project/pgmq-sqlalchemy/)
* [GitHub](https://github.com/jason810496/pgmq-sqlalchemy)
* [Documentation](https://pgmq-sqlalchemy.readthedocs.io/en/latest/)
/r/Python
https://redd.it/1ebvafo
GitHub
GitHub - jason810496/pgmq-sqlalchemy: More flexible PGMQ Postgres extension Python client that using SQLAlchemy ORM, supporting…
More flexible PGMQ Postgres extension Python client that using SQLAlchemy ORM, supporting both async and sync engines, sessionmakers or built from dsn. - jason810496/pgmq-sqlalchemy
WAT - Deep inspection of Python objects
https://github.com/igrek51/wat
# What My Project Does
This inspection tool is extremely useful for debugging in dynamically typed Python. It allows you to examine unknown objects at runtime. Specifically, you can investigate type, formatted value, variables, methods, parent types, signature, documentation, and even the source code.
Let me know what you think. I would really appreciate your feedback.
/r/Python
https://redd.it/1ebzeh2
https://github.com/igrek51/wat
# What My Project Does
This inspection tool is extremely useful for debugging in dynamically typed Python. It allows you to examine unknown objects at runtime. Specifically, you can investigate type, formatted value, variables, methods, parent types, signature, documentation, and even the source code.
Let me know what you think. I would really appreciate your feedback.
/r/Python
https://redd.it/1ebzeh2
GitHub
GitHub - igrek51/wat: Deep inspection of Python objects
Deep inspection of Python objects. Contribute to igrek51/wat development by creating an account on GitHub.
How to code better
I want to know if my implementation of the crud operation with the class-based view and the use of the dispatch function inside to handle specific methods (PUT, DELETE...) is a good idea.
https://preview.redd.it/j6dbdzqmeped1.png?width=1036&format=png&auto=webp&s=6369a7617058b2ec52f53c719b5d3a1d2866992d
https://preview.redd.it/i42tbyqmeped1.png?width=1036&format=png&auto=webp&s=be31ef7b1c61eadca60fbe5d8daf77f01589d6db
https://preview.redd.it/fwbgqzqmeped1.png?width=1036&format=png&auto=webp&s=e8d56e0c71942d64e1284c4360c0be234aed2c6b
https://preview.redd.it/rqc4oyqmeped1.png?width=691&format=png&auto=webp&s=9057b3789ebb326f29973372c7f05d25abefd863
/r/djangolearning
https://redd.it/1ec1dcu
I want to know if my implementation of the crud operation with the class-based view and the use of the dispatch function inside to handle specific methods (PUT, DELETE...) is a good idea.
https://preview.redd.it/j6dbdzqmeped1.png?width=1036&format=png&auto=webp&s=6369a7617058b2ec52f53c719b5d3a1d2866992d
https://preview.redd.it/i42tbyqmeped1.png?width=1036&format=png&auto=webp&s=be31ef7b1c61eadca60fbe5d8daf77f01589d6db
https://preview.redd.it/fwbgqzqmeped1.png?width=1036&format=png&auto=webp&s=e8d56e0c71942d64e1284c4360c0be234aed2c6b
https://preview.redd.it/rqc4oyqmeped1.png?width=691&format=png&auto=webp&s=9057b3789ebb326f29973372c7f05d25abefd863
/r/djangolearning
https://redd.it/1ec1dcu
Issue with python manage.py migrate Command Producing Red Lines
/r/djangolearning
https://redd.it/1ebke38
/r/djangolearning
https://redd.it/1ebke38
N OpenAI announces SearchGPT
https://openai.com/index/searchgpt-prototype/
> We’re testing SearchGPT, a temporary prototype of new AI search features that give you fast and timely answers with clear and relevant sources.
/r/MachineLearning
https://redd.it/1ec2gk2
https://openai.com/index/searchgpt-prototype/
> We’re testing SearchGPT, a temporary prototype of new AI search features that give you fast and timely answers with clear and relevant sources.
/r/MachineLearning
https://redd.it/1ec2gk2
Openai
SearchGPT is a prototype of new AI search features
We’re testing SearchGPT, a temporary prototype of new search features that give you fast and timely answers with clear and relevant sources.
I've made a To-Do app
I made a to-do app using Flask and JavaScript. I know it's not a big deal, but I'm proud of it anyway. This is the GitHub link if anyone is interested:
https://github.com/ITSHAYDER/To-do-app-Flask
/r/flask
https://redd.it/1ebxbyy
I made a to-do app using Flask and JavaScript. I know it's not a big deal, but I'm proud of it anyway. This is the GitHub link if anyone is interested:
https://github.com/ITSHAYDER/To-do-app-Flask
/r/flask
https://redd.it/1ebxbyy
GitHub
GitHub - ITSHAYDER/To-do-app-Flask: This repository contains a task management web application built with Flask and JavaScript.…
This repository contains a task management web application built with Flask and JavaScript. The app allows users to manage their tasks with features including adding, displaying, and deleting tasks...
Friday Daily Thread: r/Python Meta and Free-Talk Fridays
# Weekly Thread: Meta Discussions and Free Talk Friday 🎙️
Welcome to Free Talk Friday on /r/Python! This is the place to discuss the r/Python community (meta discussions), Python news, projects, or anything else Python-related!
## How it Works:
1. Open Mic: Share your thoughts, questions, or anything you'd like related to Python or the community.
2. Community Pulse: Discuss what you feel is working well or what could be improved in the /r/python community.
3. News & Updates: Keep up-to-date with the latest in Python and share any news you find interesting.
## Guidelines:
All topics should be related to Python or the /r/python community.
Be respectful and follow Reddit's Code of Conduct.
## Example Topics:
1. New Python Release: What do you think about the new features in Python 3.11?
2. Community Events: Any Python meetups or webinars coming up?
3. Learning Resources: Found a great Python tutorial? Share it here!
4. Job Market: How has Python impacted your career?
5. Hot Takes: Got a controversial Python opinion? Let's hear it!
6. Community Ideas: Something you'd like to see us do? tell us.
Let's keep the conversation going. Happy discussing! 🌟
/r/Python
https://redd.it/1eca0qf
# Weekly Thread: Meta Discussions and Free Talk Friday 🎙️
Welcome to Free Talk Friday on /r/Python! This is the place to discuss the r/Python community (meta discussions), Python news, projects, or anything else Python-related!
## How it Works:
1. Open Mic: Share your thoughts, questions, or anything you'd like related to Python or the community.
2. Community Pulse: Discuss what you feel is working well or what could be improved in the /r/python community.
3. News & Updates: Keep up-to-date with the latest in Python and share any news you find interesting.
## Guidelines:
All topics should be related to Python or the /r/python community.
Be respectful and follow Reddit's Code of Conduct.
## Example Topics:
1. New Python Release: What do you think about the new features in Python 3.11?
2. Community Events: Any Python meetups or webinars coming up?
3. Learning Resources: Found a great Python tutorial? Share it here!
4. Job Market: How has Python impacted your career?
5. Hot Takes: Got a controversial Python opinion? Let's hear it!
6. Community Ideas: Something you'd like to see us do? tell us.
Let's keep the conversation going. Happy discussing! 🌟
/r/Python
https://redd.it/1eca0qf
Redditinc
Reddit Rules
Reddit Rules - Reddit
Monthly Data Engineering Python Newsletter
https://alessandromolina.substack.com/p/python-data-engineering-july-2024
I have been working in the data engineering world for a few years, and have been contributing to many OSS projects that are foundations to it. This month I decided to start a dedicated newsletter to help everyone stay informed with what goes on in the data engineering world.
The Python Data Engineering newsletter was born as a way to scratch my own itch of having to keep up with updates to all the components that are foundations for data engineering projects in Python, and aims to be different from the usual ones that focus on data science and analytics, as it concentrates more on the fundamental building blocks needed to create platforms on which data science can run.
Hope it will be helpful for other people too and lightweight enough that it won’t introduce additional information overload for its readers.
/r/Python
https://redd.it/1ec132n
https://alessandromolina.substack.com/p/python-data-engineering-july-2024
I have been working in the data engineering world for a few years, and have been contributing to many OSS projects that are foundations to it. This month I decided to start a dedicated newsletter to help everyone stay informed with what goes on in the data engineering world.
The Python Data Engineering newsletter was born as a way to scratch my own itch of having to keep up with updates to all the components that are foundations for data engineering projects in Python, and aims to be different from the usual ones that focus on data science and analytics, as it concentrates more on the fundamental building blocks needed to create platforms on which data science can run.
Hope it will be helpful for other people too and lightweight enough that it won’t introduce additional information overload for its readers.
/r/Python
https://redd.it/1ec132n
Python Data Engineering
Python Data Engineering, July 2024
Monthly updates from the Python Data Engineering world
Project Termatus: A TUI system informatics viewer, written in Python
What my project does:
Displays most of your system's informatics with a pretty TUI in your terminal.
Who is this for:
Well anyone wanting to style their setup or just see how their computer's doing
What's better about mine:
Colorful (i guess)
Nice big banner
Space for ASCII art and also custom art can be added
Completely in the terminal
Can work on Windows AND Linux
What's worse about mine:
UI would still be considered as lacking
Too much blank spaces that probably could be utilized in better ways
Some info might not be available on different OSes
This is highly customizable. Although there isn't a menu for that, you can just go into the source code and look for things you would wanna customize like colors, ascii arts, banner text etc. Just make sure it fits the dimensions
HEAVILY INSPIRED OFF OF BPYTOP
Disclaimer: This was created in windows. Although it has been tested on a WSL2 environment, still really dont expect it to work nicely on actual Linux OS
Github: https://github.com/muaaz-ur-habibi/termatus
/r/Python
https://redd.it/1eci1y2
What my project does:
Displays most of your system's informatics with a pretty TUI in your terminal.
Who is this for:
Well anyone wanting to style their setup or just see how their computer's doing
What's better about mine:
Colorful (i guess)
Nice big banner
Space for ASCII art and also custom art can be added
Completely in the terminal
Can work on Windows AND Linux
What's worse about mine:
UI would still be considered as lacking
Too much blank spaces that probably could be utilized in better ways
Some info might not be available on different OSes
This is highly customizable. Although there isn't a menu for that, you can just go into the source code and look for things you would wanna customize like colors, ascii arts, banner text etc. Just make sure it fits the dimensions
HEAVILY INSPIRED OFF OF BPYTOP
Disclaimer: This was created in windows. Although it has been tested on a WSL2 environment, still really dont expect it to work nicely on actual Linux OS
Github: https://github.com/muaaz-ur-habibi/termatus
/r/Python
https://redd.it/1eci1y2
GitHub
GitHub - muaaz-ur-habibi/termatus: A system status UI, for your Terminal. Written in Python
A system status UI, for your Terminal. Written in Python - muaaz-ur-habibi/termatus
jinja2.exceptions.TemplateNotFound: templates/PatientView.html
I'm trying to create a simple Web App, fetching data from a MySQL table and displaying it on an HTML page. However, when I try running the .py file, I get the error: **jinja2.exceptions.TemplateNotFound: templates/Patient\View.html even though there is a Patient_View.html file in the templates folder.
Here is my .py file and the code in it:
from flask import Flask, rendertemplate, request, redirect, urlfor, flash
from flasksqlalchemy import SQLAlchemy
from import generatepasswordhash, checkpasswordhash
from flasklogin import UserMixin, LoginManager, loginuser, logoutuser, currentuser, loginrequired
from datetime import datetime
import pymysql
import logging
pymysql.installasMySQLdb()
app = Flask(name)
app.secretkey = 'Krish'
app.config['SQLALCHEMYDATABASEURI'] = 'mysql://root:@localhost/medical'
app.config['SQLALCHEMYTRACKMODIFICATIONS'] = False
db = SQLAlchemy(app)
# Set up logging
logging.basicConfig(level=logging.INFO)
# Initialize Flask-Login
loginmanager = LoginManager(app)
loginmanager.loginview = 'home' # when
/r/Python
https://redd.it/1echwyc
I'm trying to create a simple Web App, fetching data from a MySQL table and displaying it on an HTML page. However, when I try running the .py file, I get the error: **jinja2.exceptions.TemplateNotFound: templates/Patient\View.html even though there is a Patient_View.html file in the templates folder.
Here is my .py file and the code in it:
from flask import Flask, rendertemplate, request, redirect, urlfor, flash
from flasksqlalchemy import SQLAlchemy
from import generatepasswordhash, checkpasswordhash
from flasklogin import UserMixin, LoginManager, loginuser, logoutuser, currentuser, loginrequired
from datetime import datetime
import pymysql
import logging
pymysql.installasMySQLdb()
app = Flask(name)
app.secretkey = 'Krish'
app.config['SQLALCHEMYDATABASEURI'] = 'mysql://root:@localhost/medical'
app.config['SQLALCHEMYTRACKMODIFICATIONS'] = False
db = SQLAlchemy(app)
# Set up logging
logging.basicConfig(level=logging.INFO)
# Initialize Flask-Login
loginmanager = LoginManager(app)
loginmanager.loginview = 'home' # when
/r/Python
https://redd.it/1echwyc
Reddit
From the Python community on Reddit
Explore this post and more from the Python community
Having Multiple Models Upload Files to Different Paths
I have 2 main entities, a Pharmacy and a Hospital, each of them can have one-or-multiple attachments, those attachments can be photos or PDFs.
Here's my Attachment model
and as an example here are my Pharmacy and Hospital models
My goal is to be able to put the attachments of a Pharmacy into a subfolder inside attachments/ and that subfolder should be pharmacy/, so everything lives in attachments/pharmacy/. And the same applies for a hospital.
I couldn't figure out the proper way to do this I even did a Google search which turned out with nothing. Any ideas?
/r/django
https://redd.it/1ecj5pb
I have 2 main entities, a Pharmacy and a Hospital, each of them can have one-or-multiple attachments, those attachments can be photos or PDFs.
Here's my Attachment model
class Attachment(Base):
file = models.FileField(upload_to='attachments/')
def __str__(self):
return f'{self.created_at}'
and as an example here are my Pharmacy and Hospital models
class Pharmacy(Base):
attachments = models.ManyToManyField(Attachment)
...
class Hospital(Base):
attachments = models.ManyToManyField(Attachment)
...
My goal is to be able to put the attachments of a Pharmacy into a subfolder inside attachments/ and that subfolder should be pharmacy/, so everything lives in attachments/pharmacy/. And the same applies for a hospital.
I couldn't figure out the proper way to do this I even did a Google search which turned out with nothing. Any ideas?
/r/django
https://redd.it/1ecj5pb
Reddit
From the django community on Reddit
Explore this post and more from the django community
Analytics?
I still have third party cookies on my website is because I'm using Google analytics. Is it possible to use a internal module of Django to do this instead?
/r/django
https://redd.it/1ecj33e
I still have third party cookies on my website is because I'm using Google analytics. Is it possible to use a internal module of Django to do this instead?
/r/django
https://redd.it/1ecj33e
Reddit
From the django community on Reddit
Explore this post and more from the django community