Docker Usage in 'The Flask Mega-Tutorial' by Miguel Grinberg - A Review
https://vsupalov.com/flask-megatutorial-review/
/r/flask
https://redd.it/8sytzh
https://vsupalov.com/flask-megatutorial-review/
/r/flask
https://redd.it/8sytzh
vsupalov.com
Docker Usage in 'The Flask Mega-Tutorial' by Miguel Grinberg - A Review
How to make an iterator in Python
http://treyhunner.com/2018/06/how-to-make-an-iterator-in-python/
/r/Python
https://redd.it/8t3gtj
http://treyhunner.com/2018/06/how-to-make-an-iterator-in-python/
/r/Python
https://redd.it/8t3gtj
Treyhunner
How to make an iterator in Python
I wrote an article sometime ago on the iterator protocol that powers Python’s for loops.
One thing I left out of that article was how to make …
One thing I left out of that article was how to make …
Minimalist BI dashboard with zero configuration
I remember seeing a project that was a perfect match for that description. I think it was written in Python, but don't remember for sure. Now I cannot find it.
I've looked into Bokeh, Dash, Spyre, Bowtie, but none of them comes anywhere close to this description. Basically, I'm not interested in fancy plots and other graphics, just tables will be great. What I'm not interested either is dealing with JavaScript nonsense, writing HTML by hand, and so on. It is not supposed to be a pretty website for marketing. It's a tool for radiologists to run some basic queries against a database, have those queries stored in a form of dashboard and do some basic analysis of the contents of the database. Even Jupyter widgets will be an overkill for that. (Overkill means that the program will not be used / useful).
The project I'm thinking about had a kind of light blue and gray design. As a user, you'd have to specify the database you work with, and then it would present you with a dropdown listing all tables in that database. Selecting a table would launch a screen for creating a query against that table. Once query was created, you'd be able to add it to a dashboard, where you could minimally parametrize the query. A programmer would only need to make sure the database can be accessed by the dashboard, users could do all the rest by themselves, no hand-holding required.
If it helps, I remember seeing it being deployed to Heroku / maybe available as a service from Heroku.
/r/Python
https://redd.it/8t4sy4
I remember seeing a project that was a perfect match for that description. I think it was written in Python, but don't remember for sure. Now I cannot find it.
I've looked into Bokeh, Dash, Spyre, Bowtie, but none of them comes anywhere close to this description. Basically, I'm not interested in fancy plots and other graphics, just tables will be great. What I'm not interested either is dealing with JavaScript nonsense, writing HTML by hand, and so on. It is not supposed to be a pretty website for marketing. It's a tool for radiologists to run some basic queries against a database, have those queries stored in a form of dashboard and do some basic analysis of the contents of the database. Even Jupyter widgets will be an overkill for that. (Overkill means that the program will not be used / useful).
The project I'm thinking about had a kind of light blue and gray design. As a user, you'd have to specify the database you work with, and then it would present you with a dropdown listing all tables in that database. Selecting a table would launch a screen for creating a query against that table. Once query was created, you'd be able to add it to a dashboard, where you could minimally parametrize the query. A programmer would only need to make sure the database can be accessed by the dashboard, users could do all the rest by themselves, no hand-holding required.
If it helps, I remember seeing it being deployed to Heroku / maybe available as a service from Heroku.
/r/Python
https://redd.it/8t4sy4
reddit
r/Python - Minimalist BI dashboard with zero configuration
6 votes and 3 so far on reddit
New Python website - pythoncheatsheet.org
[www.pythoncheatsheet.org](https://www.pythoncheatsheet.org) \- The idea is to have an easy to use cheat sheet... I hope it can help someone else besides me.
If you like it, don't forget to check on how to [contribute](https://www.pythoncheatsheet.org/contribute)!
/r/Python
https://redd.it/8t7t16
[www.pythoncheatsheet.org](https://www.pythoncheatsheet.org) \- The idea is to have an easy to use cheat sheet... I hope it can help someone else besides me.
If you like it, don't forget to check on how to [contribute](https://www.pythoncheatsheet.org/contribute)!
/r/Python
https://redd.it/8t7t16
pythoncheatsheet.org
Python Cheat Sheet – Free, Beginner-Friendly Guide with Labs & PDF
The most complete Python cheat sheet online. Learn step-by-step with interactive labs, download free PDF cheat sheets, and explore beginner-friendly Python guides.
A Lightweight version of Djaniero for Sublime Text 3, with Template Comments Fixed
I have been programming Django in Sublime Text 3 for a while, but I always thought the Djaneiro package was way too heavy-handed.
+ I didn't want bulky version-dependent snippets.
+ I didn't want an ST3 view dedicated to "Python (Django)". I'd prefer to treat them as Python code.
+ I wanted to keep syntax highlighting for Django HTML templates. This is the "HTML (Django)" ST3 view.
+ I wanted the Ctrl+/ comment shortcut to work on Django HTML templates. Djaneiro has a 6-year old bug where the wrong comment tag is inserted. (https://github.com/squ1b3r/Djaneiro/issues/10)
So, I cloned the Djaniero plugin and deleted a bunch of the junk I didn't want. I give you `django-highlite`.
https://github.com/ConlanHoldings/django-highlite
/r/django
https://redd.it/8t2udw
I have been programming Django in Sublime Text 3 for a while, but I always thought the Djaneiro package was way too heavy-handed.
+ I didn't want bulky version-dependent snippets.
+ I didn't want an ST3 view dedicated to "Python (Django)". I'd prefer to treat them as Python code.
+ I wanted to keep syntax highlighting for Django HTML templates. This is the "HTML (Django)" ST3 view.
+ I wanted the Ctrl+/ comment shortcut to work on Django HTML templates. Djaneiro has a 6-year old bug where the wrong comment tag is inserted. (https://github.com/squ1b3r/Djaneiro/issues/10)
So, I cloned the Djaniero plugin and deleted a bunch of the junk I didn't want. I give you `django-highlite`.
https://github.com/ConlanHoldings/django-highlite
/r/django
https://redd.it/8t2udw
GitHub
Commenting on Django Templates incorrect #10
When the shortcut for commenting is pressed (Command - / ), comments are presented as standard HTML, rather than Django templates (as with the TextMate bundle).
Django Rest framework, Django OAuth Toolkit, Token authentication
Hello everyone!
I'm building a api, with authentication token. Took me a few tutorials to figure out how to get a token using postman. I'm only starting the project, there is only 3 models. Now I'm really embarrassed, how do I get the token in the real project? I mean I got it inside postman, I could access a list (json format) of users that are protected by authentications methods. But how to get access to that list in the browser. When I login using my django admin account and try to access the url with a list of users, I don't receive the list, it says "Authentication credentials were not provided." What I need to make to get it? There is something I'm missing here XD. The other models that doesn't require permissions to access, I can access it in the browser and inside postman and it show me the list of objects.
/r/django
https://redd.it/8t5mc2
Hello everyone!
I'm building a api, with authentication token. Took me a few tutorials to figure out how to get a token using postman. I'm only starting the project, there is only 3 models. Now I'm really embarrassed, how do I get the token in the real project? I mean I got it inside postman, I could access a list (json format) of users that are protected by authentications methods. But how to get access to that list in the browser. When I login using my django admin account and try to access the url with a list of users, I don't receive the list, it says "Authentication credentials were not provided." What I need to make to get it? There is something I'm missing here XD. The other models that doesn't require permissions to access, I can access it in the browser and inside postman and it show me the list of objects.
/r/django
https://redd.it/8t5mc2
reddit
r/django - Django Rest framework, Django OAuth Toolkit, Token authentication
2 votes and 1 so far on reddit
VS Code not working with Anaconda
Not sure where else to post this but all I want to do is run the libraries and packages installed through anaconda into my root environment through VS Code, the Editor.
Is there a step by step guide?
I've tried the `ctrl + shift + p` and selected my anaconda3\\python.exe environment but it still doesn't recognize the libraries I have installed? I can send exact images if that'd help.
/r/Python
https://redd.it/8t7rq4
Not sure where else to post this but all I want to do is run the libraries and packages installed through anaconda into my root environment through VS Code, the Editor.
Is there a step by step guide?
I've tried the `ctrl + shift + p` and selected my anaconda3\\python.exe environment but it still doesn't recognize the libraries I have installed? I can send exact images if that'd help.
/r/Python
https://redd.it/8t7rq4
reddit
r/Python - VS Code not working with Anaconda
4 votes and 2 so far on reddit
Customizing Django Select2 fields
I started using django-select2 with my forms in one of my apps and I am looking for how to customize the form fields.
For example, with one of the form fields you can select a country, so an icon next to the name of the country would be nice.
Also, maybe present the countries in groups like Popular or by continent.
The [Select2](https://select2.org/) site has some examples that I would like to replicate.
On [django-select2 documentation](http://django-select2.readthedocs.io/en/latest/index.html) is not clear on how to do something like that.
Have you ever tried something like this ?
/r/django
https://redd.it/8t8zek
I started using django-select2 with my forms in one of my apps and I am looking for how to customize the form fields.
For example, with one of the form fields you can select a country, so an icon next to the name of the country would be nice.
Also, maybe present the countries in groups like Popular or by continent.
The [Select2](https://select2.org/) site has some examples that I would like to replicate.
On [django-select2 documentation](http://django-select2.readthedocs.io/en/latest/index.html) is not clear on how to do something like that.
Have you ever tried something like this ?
/r/django
https://redd.it/8t8zek
select2.org
Getting Started | Select2 - The jQuery replacement for select boxes
Select2 is a jQuery based replacement for select boxes. It supports searching, remote data sets, and pagination (infinite scrolling) of results.
[noob question] can't connect to web browser with jupyter notebook on docker
Hi I've been following this tutorial ([https://github.com/pkmital/CADL/blob/master/README.md#what-is-notebook](https://github.com/pkmital/CADL/blob/master/README.md#what-is-notebook)) and trying to set up jupyter notebook on docker. I'm using windows 10 home. I manage to set up docker toolbox and clone from the github repo
Then I copied the downloaded files into the virtual machines directory using:
docker run -it -p 8888:8888 -p 6006:6006 -v /$(pwd)/CADL:/notebooks --name tf pkmital/cadl
Now when I try jupyter notebook & it shows
(base) root@eaf652bccc31:/notebooks# [W 22:02:47.479 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
[C 22:02:47.486 NotebookApp] Running as root is not recommended. Use --allow-root to bypass.
On the tutorial it says that it's suppose to be displaying:
[I 21:15:33.647 NotebookApp] Writing notebook server cookie secret to /root/.local/share/jupyter/runtime/notebook_cookie_secret
[W 21:15:33.712 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
[W 21:15:33.713 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using authentication. This is highly insecure and not recommended.
[I 21:15:33.720 NotebookApp] Serving notebooks from local directory: /root
[I 21:15:33.721 NotebookApp] 0 active kernels
[I 21:15:33.721 NotebookApp] The IPython Notebook is running at: http://[all ip addresses on your system]:8888/
[I 21:15:33.721 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
When I try to connect to [192.168.99.101:8888](https://192.168.99.101:8888) it says connection refused but i can successfully ping [192.168.99.101](https://192.168.99.101) \- the docker ip. Also Ive opened my port from my firewall between 49152 to 65535 and tried turning it off completely but it still doesn't seem to work.
Any help or pointers be great!
/r/IPython
https://redd.it/8tbk9b
Hi I've been following this tutorial ([https://github.com/pkmital/CADL/blob/master/README.md#what-is-notebook](https://github.com/pkmital/CADL/blob/master/README.md#what-is-notebook)) and trying to set up jupyter notebook on docker. I'm using windows 10 home. I manage to set up docker toolbox and clone from the github repo
Then I copied the downloaded files into the virtual machines directory using:
docker run -it -p 8888:8888 -p 6006:6006 -v /$(pwd)/CADL:/notebooks --name tf pkmital/cadl
Now when I try jupyter notebook & it shows
(base) root@eaf652bccc31:/notebooks# [W 22:02:47.479 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
[C 22:02:47.486 NotebookApp] Running as root is not recommended. Use --allow-root to bypass.
On the tutorial it says that it's suppose to be displaying:
[I 21:15:33.647 NotebookApp] Writing notebook server cookie secret to /root/.local/share/jupyter/runtime/notebook_cookie_secret
[W 21:15:33.712 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
[W 21:15:33.713 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using authentication. This is highly insecure and not recommended.
[I 21:15:33.720 NotebookApp] Serving notebooks from local directory: /root
[I 21:15:33.721 NotebookApp] 0 active kernels
[I 21:15:33.721 NotebookApp] The IPython Notebook is running at: http://[all ip addresses on your system]:8888/
[I 21:15:33.721 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
When I try to connect to [192.168.99.101:8888](https://192.168.99.101:8888) it says connection refused but i can successfully ping [192.168.99.101](https://192.168.99.101) \- the docker ip. Also Ive opened my port from my firewall between 49152 to 65535 and tried turning it off completely but it still doesn't seem to work.
Any help or pointers be great!
/r/IPython
https://redd.it/8tbk9b
GitHub
pkmital/CADL
Course materials/Homework materials for the FREE MOOC course on "Creative Applications of Deep Learning w/ Tensorflow" #CADL
url_for() pathing not working, but same path as hardcoded - for images
In my html page, I am using this:
<div class="py-5 text-center opaque-overlay" style="background-image: url(/static/images/pexels-photo-259962.jpeg)">
in a div tag, and it loads the image no problem.
Once I switch to
<div class="py-5 text-center opaque-overlay" style="background-image: {{ url_for('static', filename='images/pexels-photo-259962.jpeg') }}">
It doesn't work. When I display the results of the path, it's the same as the html one. Does anyone know what's going on?
/r/flask
https://redd.it/8tczio
In my html page, I am using this:
<div class="py-5 text-center opaque-overlay" style="background-image: url(/static/images/pexels-photo-259962.jpeg)">
in a div tag, and it loads the image no problem.
Once I switch to
<div class="py-5 text-center opaque-overlay" style="background-image: {{ url_for('static', filename='images/pexels-photo-259962.jpeg') }}">
It doesn't work. When I display the results of the path, it's the same as the html one. Does anyone know what's going on?
/r/flask
https://redd.it/8tczio
reddit
r/flask - url_for() pathing not working, but same path as hardcoded - for images
1 votes and 1 so far on reddit
Django - Sharing Postgres Database with another Python Process using Peewee
So I am writing a Django Web App to wrap a Python Program I wrote that does some stuff. The Django Web App needs to be able to access one table called "Searching" in the PostgreSQL DB and insert data into it. I am wondering though, how do I access this table when its not defined as a model in Django but "managed" by peewee in the other Python program?
Do I just need to use inspectdb and create unmanaged models I guess?
https://docs.djangoproject.com/en/2.0/howto/legacy-databases/
/r/django
https://redd.it/8tb6m1
So I am writing a Django Web App to wrap a Python Program I wrote that does some stuff. The Django Web App needs to be able to access one table called "Searching" in the PostgreSQL DB and insert data into it. I am wondering though, how do I access this table when its not defined as a model in Django but "managed" by peewee in the other Python program?
Do I just need to use inspectdb and create unmanaged models I guess?
https://docs.djangoproject.com/en/2.0/howto/legacy-databases/
/r/django
https://redd.it/8tb6m1
reddit
r/django - Django - Sharing Postgres Database with another Python Process using Peewee
8 votes and 3 so far on reddit
I published my repository, pyray for making mathematical visualizations on pypi, added builds and tests.
https://github.com/ryu577/pyray
/r/Python
https://redd.it/8tc86g
https://github.com/ryu577/pyray
/r/Python
https://redd.it/8tc86g
GitHub
GitHub - ryu577/pyray: A 3d rendering library written completely in python.
A 3d rendering library written completely in python. - ryu577/pyray
Best global search engines for a django app?
I was looking to add a search functionality to my django app, I know haystack is great but I don't think it can search globally but can only conduct searches on specific models(Please correct me if I'm wrong I'm new to django). Is there a way to implement a global search function for all the models that I can just put on my index page?
/r/django
https://redd.it/8tcgfd
I was looking to add a search functionality to my django app, I know haystack is great but I don't think it can search globally but can only conduct searches on specific models(Please correct me if I'm wrong I'm new to django). Is there a way to implement a global search function for all the models that I can just put on my index page?
/r/django
https://redd.it/8tcgfd
reddit
r/django - Best global search engines for a django app?
2 votes and 4 so far on reddit
Small package to quickly and easily generate a color palette from an image.
https://github.com/Dilan1020/PyColorPalette
/r/Python
https://redd.it/8tdse7
https://github.com/Dilan1020/PyColorPalette
/r/Python
https://redd.it/8tdse7
GitHub
Dilan1020/PyColorPalette
PyColorPalette is a tool capable of pulling a list of the top colors, or the color at a specific index, from a given image via the process of K-means clustering. Images can be provided either throu...
SQLAlchemy: ORM vs database level cascades
Hi everybody, I've written a short post about SQLAlchemy and cascading deletes. This was a topic that actually turned out to be a bit more nuanced than I thought. Hopefully an interesting read.
[SQLAlchemy: ORM vs database level cascades](http://www.codetodd.com/sqlalchemy-orm-vs-database-level-cascades/)
/r/Python
https://redd.it/8td7cc
Hi everybody, I've written a short post about SQLAlchemy and cascading deletes. This was a topic that actually turned out to be a bit more nuanced than I thought. Hopefully an interesting read.
[SQLAlchemy: ORM vs database level cascades](http://www.codetodd.com/sqlalchemy-orm-vs-database-level-cascades/)
/r/Python
https://redd.it/8td7cc
How do I receive websocket data from several APIs in parallel in a non blocking manner?
Hi everyone,
Newbie here. I searched for "websockets" on this group and saw a lot of posts where people are talking about sending data from their server to their client. My case is slightly different and therefore had to ask this question. I am planning to fetch data from several APIs that support websocket connections. I am familiar with how this is handled in node.js but here in Flask everything seems so different, so blocking :) no pun intended
1. Should I add Tornado on top of Flask? I saw some answers on [Stackoverflow](https://stackoverflow.com/questions/8143141/using-flask-and-tornado-together) about the same
2. Should I add websocket code inside Celery with Flask, I am already using Celery in my application. I read somewhere that Celery tasks should not be long running. Aren't websockets streams infinite
3. I am assuming If I had to listen to 10 websocket APIs I would be blocking the entire frontend. A headstart from you guys on how to proceed would be super appreciated
/r/flask
https://redd.it/8tgv42
Hi everyone,
Newbie here. I searched for "websockets" on this group and saw a lot of posts where people are talking about sending data from their server to their client. My case is slightly different and therefore had to ask this question. I am planning to fetch data from several APIs that support websocket connections. I am familiar with how this is handled in node.js but here in Flask everything seems so different, so blocking :) no pun intended
1. Should I add Tornado on top of Flask? I saw some answers on [Stackoverflow](https://stackoverflow.com/questions/8143141/using-flask-and-tornado-together) about the same
2. Should I add websocket code inside Celery with Flask, I am already using Celery in my application. I read somewhere that Celery tasks should not be long running. Aren't websockets streams infinite
3. I am assuming If I had to listen to 10 websocket APIs I would be blocking the entire frontend. A headstart from you guys on how to proceed would be super appreciated
/r/flask
https://redd.it/8tgv42
Stack Overflow
using Flask and Tornado together?
I am a big fan of Flask - in part because it is simple and in part because has a lot of extensions. However, Flask is meant to be used in a WSGI environment, and WSGI is not a non-blocking, so (I
Django and VueJS Integration: Project Structure and Vue Server
So i wanted to use Django with Vue and i was fine with using it just with a jquery script tag but then i saw the Vue tutorial using Vue-cli and making its own .vue files and starting vue's own server. So how do i go about arraging those vue files with my django ones and do i need to run another server along with django.
/r/django
https://redd.it/8thlap
So i wanted to use Django with Vue and i was fine with using it just with a jquery script tag but then i saw the Vue tutorial using Vue-cli and making its own .vue files and starting vue's own server. So how do i go about arraging those vue files with my django ones and do i need to run another server along with django.
/r/django
https://redd.it/8thlap
reddit
r/django - Django and VueJS Integration: Project Structure and Vue Server
2 votes and 3 so far on reddit
Help: Displaying a date field when checkbox is checked (Admin side)
Hello everyone, as the title suggests, I am trying to display a date field when a checkbox is picked on the Admin side.
I have created the following model in my app:
class CoursePeriods(models.Model):
...
is_running = models.BooleanField()
end_date = models.DateField(validators=[validate_date])
So basically, when is_running is set to True, display the field for end_date, is_running is False, hide the end_date field. I only want this in the Admin side.
I have googled for a solution and found this which I have tried, using Chris P's answer: https://stackoverflow.com/questions/15978719/django-admin-show-field-only-if-checkbox-is-false
However, I am not sure about something Where do I create the Javascript file? Is it in my app's static folder or venv/Lib/site-packages/django/contrib/admin/static/
I've tried creating my Javascript file in both locations (not at the same time), and I have already defined the class Media in admin.py. However, when I accessed the admin site to that particular model, I can't seem to find my Javascript file anywhere.
I read that I need to call for the Javascript file in a template but I'm not sure which. Thank you for your help.
TL;DR: How do I display a end_date's field when is_checked's checkbox is set to True and hide it when it is false (By default it should be hidden)
/r/djangolearning
https://redd.it/8tghhq
Hello everyone, as the title suggests, I am trying to display a date field when a checkbox is picked on the Admin side.
I have created the following model in my app:
class CoursePeriods(models.Model):
...
is_running = models.BooleanField()
end_date = models.DateField(validators=[validate_date])
So basically, when is_running is set to True, display the field for end_date, is_running is False, hide the end_date field. I only want this in the Admin side.
I have googled for a solution and found this which I have tried, using Chris P's answer: https://stackoverflow.com/questions/15978719/django-admin-show-field-only-if-checkbox-is-false
However, I am not sure about something Where do I create the Javascript file? Is it in my app's static folder or venv/Lib/site-packages/django/contrib/admin/static/
I've tried creating my Javascript file in both locations (not at the same time), and I have already defined the class Media in admin.py. However, when I accessed the admin site to that particular model, I can't seem to find my Javascript file anywhere.
I read that I need to call for the Javascript file in a template but I'm not sure which. Thank you for your help.
TL;DR: How do I display a end_date's field when is_checked's checkbox is set to True and hide it when it is false (By default it should be hidden)
/r/djangolearning
https://redd.it/8tghhq
Stack Overflow
django admin show field only if checkbox is false
models.py
class Menu(models.Model):
...
has_submenu=models.BooleanField(default=1)
page=models.ForeignKey(Page,null=True)
I want django admin shows the page attribute only if has_sub...
class Menu(models.Model):
...
has_submenu=models.BooleanField(default=1)
page=models.ForeignKey(Page,null=True)
I want django admin shows the page attribute only if has_sub...
Is django a safe (future forward) framework to learn?
I only ask because, after building up a site on localhost, when I tried to move the server onto Hostgator I was told HostGator will not assist with installation or support of Django. What gives?
(I also know that I'm asking on the Django subreddit and that may lead to biased responses.)
/r/django
https://redd.it/8tjq29
I only ask because, after building up a site on localhost, when I tried to move the server onto Hostgator I was told HostGator will not assist with installation or support of Django. What gives?
(I also know that I'm asking on the Django subreddit and that may lead to biased responses.)
/r/django
https://redd.it/8tjq29
reddit
r/django - Is django a safe (future forward) framework to learn?
1 votes and 1 so far on reddit