Microservices with Docker, Flask, and React
https://testdriven.io/part-four-e2e-test-setup/
/r/flask
https://redd.it/7d3a7y
https://testdriven.io/part-four-e2e-test-setup/
/r/flask
https://redd.it/7d3a7y
reddit
Microservices with Docker, Flask, and React • r/flask
4 points and 1 comments so far on reddit
Automating the Boring Search for an iPhone X
http://anthonyfox.io/iphone
/r/Python
https://redd.it/7d4b91
http://anthonyfox.io/iphone
/r/Python
https://redd.it/7d4b91
Anthony Fox
For reasons I still don’t understand, T-Mobile effectively prevented me from preordering the iPhone X. This had something to do with Apples payment plans and T-Mobile’s stipulations. It ultimately meant that if I wanted an iPhone X I’d have to go in store…
Simple way to navigate a JSON object?
Is there a simple way to navigate a large JSON object in jupyter notebook?
For example in https://jsonformatter.curiousconcept.com I can paste in a json object and then minimize/expand different layers. This is much more productive than reading through a printed json object.
I could just paste in the json object I get into the above site, but I would like a solution with the notebook so I can have a simpler workflow.
/r/JupyterNotebooks
https://redd.it/7d4zrh
Is there a simple way to navigate a large JSON object in jupyter notebook?
For example in https://jsonformatter.curiousconcept.com I can paste in a json object and then minimize/expand different layers. This is much more productive than reading through a printed json object.
I could just paste in the json object I get into the above site, but I would like a solution with the notebook so I can have a simpler workflow.
/r/JupyterNotebooks
https://redd.it/7d4zrh
Curiousconcept
JSON Formatter & Validator
Format and validate JSON data so that it can easily be read by human beings.
What's up with Shuup (previously Shoop)?
TL;DR: Is Shuup about to go subscription/enterprise mode with a limited CE edition?
Asking because:
* Search for shoop/shuup on r/django turns up ONE result,
* 2 months ago shoop was renamed shuup with a new github repo, it has ONE commit since then,
* shuup.com menu for "Products" only lists "Entersprise" and "Why shuup?",
* Download page goes to typical marketing signup-before-download page,
* Only mention of github is in the footer,
* Install docs for latest version doesn't work, requires multiple tweaks to even get to the migration.
Longer version:
I'm evaluating CMS+eCommerce options for a freelance project I've been asked to send a proposal for. I wished to try something different than the wordpress swamp this time, preferably python since I dunno, I like it?
My search first lead me to Saleor (not customizable enough for my client) -> Django-CMS+Django-Shop (couldn't get the apphooks to work easily) -> Django-Oscar (too basic, tight deadline) -> Mezzanine+Cartridge (my weapon of choice, everything just worked). But another team member suggested I check shuup as well, because they seemed to have more features (demo page looks very nice: https://demo2.shuup.com/), but the more I read and check about shuup the less I feel for it. All the activity graphs of their repos are equally dead. I mean, they have more stars, followers and forks than Cartridge, but no commits in 2 months?
Am I missing something obvious here? To me it seems like they've been bought and are in a hush-hush phase of commercializing the product and mainly focus on an enterprise version.
I just don't want to be stuck with a non-supported and/or costly framework for this project...
EDIT: Typo
/r/django
https://redd.it/7d5t15
TL;DR: Is Shuup about to go subscription/enterprise mode with a limited CE edition?
Asking because:
* Search for shoop/shuup on r/django turns up ONE result,
* 2 months ago shoop was renamed shuup with a new github repo, it has ONE commit since then,
* shuup.com menu for "Products" only lists "Entersprise" and "Why shuup?",
* Download page goes to typical marketing signup-before-download page,
* Only mention of github is in the footer,
* Install docs for latest version doesn't work, requires multiple tweaks to even get to the migration.
Longer version:
I'm evaluating CMS+eCommerce options for a freelance project I've been asked to send a proposal for. I wished to try something different than the wordpress swamp this time, preferably python since I dunno, I like it?
My search first lead me to Saleor (not customizable enough for my client) -> Django-CMS+Django-Shop (couldn't get the apphooks to work easily) -> Django-Oscar (too basic, tight deadline) -> Mezzanine+Cartridge (my weapon of choice, everything just worked). But another team member suggested I check shuup as well, because they seemed to have more features (demo page looks very nice: https://demo2.shuup.com/), but the more I read and check about shuup the less I feel for it. All the activity graphs of their repos are equally dead. I mean, they have more stars, followers and forks than Cartridge, but no commits in 2 months?
Am I missing something obvious here? To me it seems like they've been bought and are in a hush-hush phase of commercializing the product and mainly focus on an enterprise version.
I just don't want to be stuck with a non-supported and/or costly framework for this project...
EDIT: Typo
/r/django
https://redd.it/7d5t15
django-Filter: Only show filter options contained in queryset
I'm using the excellent [django-filter](https://github.com/carltongibson/django-filter) app to filter a queryset of model objects. Let's say my model and view look as follows:
#model
[...]
class Animal(models.Model):
REGION_CHOICES = (
(0, 'Africa'),
(1, 'Europe'),
)
name = models.CharField(max_length=100)
region = models.CharField(choices=REGION_CHOICES, max_length=100)
[...]
#view
[...]
qs = Animal.objects.all()
filter = AnimalFilter(request.GET, qs)
[...]
Assuming there are two animals in the database:
zebra = Animal(name='Zebra', region='Africa')
frog = Animal(name='Frog', region'Europe')
When I render the filter in the template, I correctly get a selector for region which contains the two options Europe and Africa.
But if I use some logic in the view to .exclude() objects from the queryset like this:
#view
[...]
qs = Animal.objects.all().exclude(name='Frog')
filter = AnimalFilter(request.GET, qs)
[...]
Now if I render the filter in the template I still get the two optione Europe and Africa for region although the queryset only contains one animal which has the region Africa.
Any ideas how I could get the correct options for the region field rendered in the template? Any help is greatly appreciated.
/r/djangolearning
https://redd.it/7d32ck
I'm using the excellent [django-filter](https://github.com/carltongibson/django-filter) app to filter a queryset of model objects. Let's say my model and view look as follows:
#model
[...]
class Animal(models.Model):
REGION_CHOICES = (
(0, 'Africa'),
(1, 'Europe'),
)
name = models.CharField(max_length=100)
region = models.CharField(choices=REGION_CHOICES, max_length=100)
[...]
#view
[...]
qs = Animal.objects.all()
filter = AnimalFilter(request.GET, qs)
[...]
Assuming there are two animals in the database:
zebra = Animal(name='Zebra', region='Africa')
frog = Animal(name='Frog', region'Europe')
When I render the filter in the template, I correctly get a selector for region which contains the two options Europe and Africa.
But if I use some logic in the view to .exclude() objects from the queryset like this:
#view
[...]
qs = Animal.objects.all().exclude(name='Frog')
filter = AnimalFilter(request.GET, qs)
[...]
Now if I render the filter in the template I still get the two optione Europe and Africa for region although the queryset only contains one animal which has the region Africa.
Any ideas how I could get the correct options for the region field rendered in the template? Any help is greatly appreciated.
/r/djangolearning
https://redd.it/7d32ck
GitHub
GitHub - carltongibson/django-filter: A generic system for filtering Django QuerySets based on user selections
A generic system for filtering Django QuerySets based on user selections - carltongibson/django-filter
How do i filter Django list using my bootstrap form?
I have been using Django and its default admin templates for my app. There is a certain list view for which I have decided to create my own bootstrap form for filtering objects. I want the values in the form fields to be used to filter on the queryset. How do I POST the data to Django and tell it to reload the page bearing in mind the choices in the form? Basically, how do I tell Django to "refresh this page" but apply the values in the form to queryset? Here is my code for the customized list
{% extends 'admin/change_list.html' %}
{% load i18n admin_urls static admin_list %}
{% block extrastyle %}
{{ block.super }}
<link rel="stylesheet" type="text/css" href="{% static "admin/css/changelists.css" %}" />
{% if cl.formset %}
<link rel="stylesheet" type="text/css" href="{% static "admin/css/forms.css" %}" />
{% endif %}
{% if cl.formset or action_form %}
<script type="text/javascript" src="{% url 'admin:jsi18n' %}"></script>
{% endif %}
{{ media.css }}
{% if not actions_on_top and not actions_on_bottom %}
<style>
#changelist table thead th:first-child {width: inherit}
</style>
{% endif %}
{% endblock %}
{% block content_title %}
<h1> Activity Summary </h1>
{% endblock %}
{% block object-tools-items %}
{% if has_add_permission %}
{{ block.super }}
<!-- Modal -->
<button type="button" data-toggle="modal" data-target="#filterModal" class="btn btn-primary">Launch modal</button>
<div class="modal fade" id="filterModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Filter</h4>
</div>
<div class="modal-body">
<form>
<div class="form-group">
<label for="user">Users:</label>
<input type="text" class="form-control" id="user">
</div>
<div class="form-group">
<label for="text">Date</label>
<input type="text" class="form-control" id="text">
</div>
<div class="checkbox">
<label><input type="checkbox"> Verified </label>
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
</div>
<div class="modal-footer">
<a href="#" data-dismiss="modal" class="btn">Close</a>
<a href="#" class="btn btn-primary">Save changes</a>
</div>
</div>
</div>
</div>
{% endif %}
{% endblock %}
{% load humanize %}
{% block result_list %}
<script type="text/javascript">
$(document).ready(function() {
$("#user").autocomplete(
{
minLength: 2,
source: function (request, response)
{
$.ajax(
{
url: "/autocomplete/",
data: {term: request.term},
dataType: "json",
appendTo : "ui-id-1",
success: function (jsonDataReceivedFromServer)
{
//alert (JSON.stringify (jsonDataReceivedFromServer));
// console.log (jsonDataReceivedFromServer);
response ($.map(jsonDataReceivedFromServer, function (item)
{
console.log (item.firstname);
return {
id: item.firstname, value: item.email, label: item.firstname };
}));
}
});
},
});
});
</script>
<div class="results">
<table>
<thead>
<tr>
<th>
<div class="text">
<a href="#">Employee</a>
</div>
</th>
<th>
</table>
</div>
{% endblock %}
{% block pagination %}{% endblock %}
/r/djangolearning
https://redd.it/7d2kaj
I have been using Django and its default admin templates for my app. There is a certain list view for which I have decided to create my own bootstrap form for filtering objects. I want the values in the form fields to be used to filter on the queryset. How do I POST the data to Django and tell it to reload the page bearing in mind the choices in the form? Basically, how do I tell Django to "refresh this page" but apply the values in the form to queryset? Here is my code for the customized list
{% extends 'admin/change_list.html' %}
{% load i18n admin_urls static admin_list %}
{% block extrastyle %}
{{ block.super }}
<link rel="stylesheet" type="text/css" href="{% static "admin/css/changelists.css" %}" />
{% if cl.formset %}
<link rel="stylesheet" type="text/css" href="{% static "admin/css/forms.css" %}" />
{% endif %}
{% if cl.formset or action_form %}
<script type="text/javascript" src="{% url 'admin:jsi18n' %}"></script>
{% endif %}
{{ media.css }}
{% if not actions_on_top and not actions_on_bottom %}
<style>
#changelist table thead th:first-child {width: inherit}
</style>
{% endif %}
{% endblock %}
{% block content_title %}
<h1> Activity Summary </h1>
{% endblock %}
{% block object-tools-items %}
{% if has_add_permission %}
{{ block.super }}
<!-- Modal -->
<button type="button" data-toggle="modal" data-target="#filterModal" class="btn btn-primary">Launch modal</button>
<div class="modal fade" id="filterModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Filter</h4>
</div>
<div class="modal-body">
<form>
<div class="form-group">
<label for="user">Users:</label>
<input type="text" class="form-control" id="user">
</div>
<div class="form-group">
<label for="text">Date</label>
<input type="text" class="form-control" id="text">
</div>
<div class="checkbox">
<label><input type="checkbox"> Verified </label>
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
</div>
<div class="modal-footer">
<a href="#" data-dismiss="modal" class="btn">Close</a>
<a href="#" class="btn btn-primary">Save changes</a>
</div>
</div>
</div>
</div>
{% endif %}
{% endblock %}
{% load humanize %}
{% block result_list %}
<script type="text/javascript">
$(document).ready(function() {
$("#user").autocomplete(
{
minLength: 2,
source: function (request, response)
{
$.ajax(
{
url: "/autocomplete/",
data: {term: request.term},
dataType: "json",
appendTo : "ui-id-1",
success: function (jsonDataReceivedFromServer)
{
//alert (JSON.stringify (jsonDataReceivedFromServer));
// console.log (jsonDataReceivedFromServer);
response ($.map(jsonDataReceivedFromServer, function (item)
{
console.log (item.firstname);
return {
id: item.firstname, value: item.email, label: item.firstname };
}));
}
});
},
});
});
</script>
<div class="results">
<table>
<thead>
<tr>
<th>
<div class="text">
<a href="#">Employee</a>
</div>
</th>
<th>
</table>
</div>
{% endblock %}
{% block pagination %}{% endblock %}
/r/djangolearning
https://redd.it/7d2kaj
reddit
How do i filter Django list using my bootstrap... • r/djangolearning
I have been using Django and its default admin templates for my app. There is a certain list view for which I have decided to create my own...
[D] Should we introduce an "Inaccurate"/"Misleading" tag for posts?
As a moderator, simply removing a post doesn't seem to curb the amount self-promotion and inaccurate submissions that continue to crop up. This is mainly because these posts come from a different author each time.
There's no incentive to not post since there will be some amount of visibility before it gets removed. To disincentivize these types of posts, should we introduce "Inaccurate" and "Misleading" tags to inform the community that the post could be misleading. The author can appeal this tag with the moderators, but it will be at our discretion whether it will be removed or not.
/r/MachineLearning
https://redd.it/7d6dkw
As a moderator, simply removing a post doesn't seem to curb the amount self-promotion and inaccurate submissions that continue to crop up. This is mainly because these posts come from a different author each time.
There's no incentive to not post since there will be some amount of visibility before it gets removed. To disincentivize these types of posts, should we introduce "Inaccurate" and "Misleading" tags to inform the community that the post could be misleading. The author can appeal this tag with the moderators, but it will be at our discretion whether it will be removed or not.
/r/MachineLearning
https://redd.it/7d6dkw
reddit
[D] Should we introduce an... • r/MachineLearning
As a moderator, simply removing a post doesn't seem to curb the amount self-promotion and inaccurate submissions that continue to crop up. This is...
Install flask production on centos 7
I can't find a tutorial online that gives a step by step on how to install Flask for production on Centos 7 that uses port 80 with either nginix or apache. Does anyone have a good tutorial on this? It's always setting it up with "venv" and then port 5000. I want to use it on a production machine on port 80 but can't find a good tutorial.
/r/flask
https://redd.it/7d8ue0
I can't find a tutorial online that gives a step by step on how to install Flask for production on Centos 7 that uses port 80 with either nginix or apache. Does anyone have a good tutorial on this? It's always setting it up with "venv" and then port 5000. I want to use it on a production machine on port 80 but can't find a good tutorial.
/r/flask
https://redd.it/7d8ue0
reddit
Install flask production on centos 7 • r/flask
I can't find a tutorial online that gives a step by step on how to install Flask for production on Centos 7 that uses port 80 with either nginix...
Dropbox releases PyAnnotate -- auto-generate type annotations for mypy
http://mypy-lang.blogspot.de/2017/11/dropbox-releases-pyannotate-auto.html
/r/Python
https://redd.it/7d7aqw
http://mypy-lang.blogspot.de/2017/11/dropbox-releases-pyannotate-auto.html
/r/Python
https://redd.it/7d7aqw
mypy-lang.blogspot.co.uk
Dropbox releases PyAnnotate -- auto-generate type annotations for mypy
For statically checking Python code, mypy is great, but it only works after you have added type annotations to your codebase. When you h...
Django 2.0 release candidate 1 released | Weblog
https://www.djangoproject.com/weblog/2017/nov/15/django-20-release-candidate-1-released/
/r/Python
https://redd.it/7d8r0x
https://www.djangoproject.com/weblog/2017/nov/15/django-20-release-candidate-1-released/
/r/Python
https://redd.it/7d8r0x
reddit
Django 2.0 release candidate 1 released | Weblog • r/Python
19 points and 1 comments so far on reddit
Django 2.0 release candidate 1 released | Weblog
https://www.djangoproject.com/weblog/2017/nov/15/django-20-release-candidate-1-released/
/r/django
https://redd.it/7d8ta8
https://www.djangoproject.com/weblog/2017/nov/15/django-20-release-candidate-1-released/
/r/django
https://redd.it/7d8ta8
reddit
Django 2.0 release candidate 1 released | Weblog • r/django
38 points and 1 comments so far on reddit
[N] Numpy dropping Python 2.7
https://github.com/numpy/numpy/blob/master/doc/neps/dropping-python2.7-proposal.rst
/r/MachineLearning
https://redd.it/7d7ge0
https://github.com/numpy/numpy/blob/master/doc/neps/dropping-python2.7-proposal.rst
/r/MachineLearning
https://redd.it/7d7ge0
[AF] Example of Flask app w/search form
I'm a new Flask (and Python) user, and was wondering if there is a good example of a Flask application that uses a search form as a basis for a database query. Especially if it uses Pagination.
Miguel's tutorial has an example of full-text search, but in general the things I've found only show some simpler parts of the process--using forms for user login, or getting all examples of something from the database (and then paginating this). I'd love a good model to follow for generating a perhaps-complicated query, which would involve using non-trivial bits of WTForms, SQLAlchemy, &c.
/r/flask
https://redd.it/7d527c
I'm a new Flask (and Python) user, and was wondering if there is a good example of a Flask application that uses a search form as a basis for a database query. Especially if it uses Pagination.
Miguel's tutorial has an example of full-text search, but in general the things I've found only show some simpler parts of the process--using forms for user login, or getting all examples of something from the database (and then paginating this). I'd love a good model to follow for generating a perhaps-complicated query, which would involve using non-trivial bits of WTForms, SQLAlchemy, &c.
/r/flask
https://redd.it/7d527c
reddit
[AF] Example of Flask app w/search form • r/flask
I'm a new Flask (and Python) user, and was wondering if there is a good example of a Flask application that uses a search form as a basis for a...
I wrote an article for Florida CPA Today on why accountants should learn Python
http://www.ficpa.org/Content/Files/Docs/Flipbooks/2017/NovDec.pdf
/r/Python
https://redd.it/7d6i0z
http://www.ficpa.org/Content/Files/Docs/Flipbooks/2017/NovDec.pdf
/r/Python
https://redd.it/7d6i0z
reddit
I wrote an article for Florida CPA Today on why... • r/Python
43 points and 1 comments so far on reddit
Flask apache hello world
I have an amazon aws server and was attempting to use flask to do a simple hello world on the server.
I have tried a few options listed at http://flask.pocoo.org/docs/0.12/deploying/ and can't seem to get any of them to work and I'm not entirely sure why. I also can't seem to find a simple hello world tutorial showing what I am trying to do.
So my question is what is the simplest way to have my server when accessed through a web browser display "Hello World"
Note the script is called hello_world.py: https://pastebin.com/30nutV4c
/r/flask
https://redd.it/7dbo3x
I have an amazon aws server and was attempting to use flask to do a simple hello world on the server.
I have tried a few options listed at http://flask.pocoo.org/docs/0.12/deploying/ and can't seem to get any of them to work and I'm not entirely sure why. I also can't seem to find a simple hello world tutorial showing what I am trying to do.
So my question is what is the simplest way to have my server when accessed through a web browser display "Hello World"
Note the script is called hello_world.py: https://pastebin.com/30nutV4c
/r/flask
https://redd.it/7dbo3x
Pastebin
[Python] from flask import Flask app = Flask(__name__) @app.route('/') def index() - Pastebin.com
Flask, Docker + Google Cloud Platform
Hey guys,
I'm currently working on a pretty basic dockerized Flask application that consists of three containers, one for nginx, postgres and the flask_app itself. Everything works fine locally so no problems there what so ever. The point of the project however is to deploy such an application across some cloud platforms in a scalable way, enter Google Cloud Platform (gcp).
I have a cluster deployed on gcp and want to deploy to it. Instead of using a postgres container now (as I do locally) I've created a PostgreSQL db on gcp that I can use across my application. I've pushed my docker images sans the postgres image to the container registry and then I attempt to deploy using a deploy.yml (https://gist.github.com/tnolan8/b608c77ca4dff70bb48f8ae88408ff85) file. This is where I'm running into issues.
I'm using Flask-SqlAlchemy within the application to connect with my db, but no matter what connection string I seem to use I can't get the db to work with my application. I figure it must be something I'm doing incorrectly with my deploy.yml file and/or my connection string I'm setting in my app config for SQLALCHEMY_DATABASE_URI. What should I be setting this variable to? I'm relatively new to gcp and Kubernetes in general and would really appreciated any help/examples people may have.
Thank you!
/r/flask
https://redd.it/7d4c2c
Hey guys,
I'm currently working on a pretty basic dockerized Flask application that consists of three containers, one for nginx, postgres and the flask_app itself. Everything works fine locally so no problems there what so ever. The point of the project however is to deploy such an application across some cloud platforms in a scalable way, enter Google Cloud Platform (gcp).
I have a cluster deployed on gcp and want to deploy to it. Instead of using a postgres container now (as I do locally) I've created a PostgreSQL db on gcp that I can use across my application. I've pushed my docker images sans the postgres image to the container registry and then I attempt to deploy using a deploy.yml (https://gist.github.com/tnolan8/b608c77ca4dff70bb48f8ae88408ff85) file. This is where I'm running into issues.
I'm using Flask-SqlAlchemy within the application to connect with my db, but no matter what connection string I seem to use I can't get the db to work with my application. I figure it must be something I'm doing incorrectly with my deploy.yml file and/or my connection string I'm setting in my app config for SQLALCHEMY_DATABASE_URI. What should I be setting this variable to? I'm relatively new to gcp and Kubernetes in general and would really appreciated any help/examples people may have.
Thank you!
/r/flask
https://redd.it/7d4c2c
Gist
deploy.yml
Are you still on Python2? What is stopping you moving to Python3?
Any comments or links welcome. I'm trying to understand what the barriers are that keep us on Python2
/r/Python
https://redd.it/7dcgnq
Any comments or links welcome. I'm trying to understand what the barriers are that keep us on Python2
/r/Python
https://redd.it/7dcgnq
reddit
Are you still on Python2? What is stopping you moving... • r/Python
Any comments or links welcome. I'm trying to understand what the barriers are that keep us on Python2
Use Rust to write Python modules
https://developers.redhat.com/blog/2017/11/16/speed-python-using-rust/
/r/Python
https://redd.it/7dct9v
https://developers.redhat.com/blog/2017/11/16/speed-python-using-rust/
/r/Python
https://redd.it/7dct9v
Red Hat Developer
Speed up your Python using Rust | Red Hat Developer
What is Rust? Rust is a systems programming language that runs blazingly fast, prevents segfaults, and guarantees thread safety. Featuring zero-cost abstractions move semantics guaranteed memory
javascripthon 0.8 released
Hello,
i'm pleased to announce a new release of javascripthon, the lean Python
to ES6 JavaScript translator. New in this release:
- add support for ``except`` sections with more than one exception
type and arbitrary exception variable name. Thanks to @devanlai;
- dict keys conversion fixes;
- enable ``--inline-map`` when translating a string with ``-s``;
See https://github.com/azazel75/metapensiero.pj for more info
cheers,
Alberto
/r/Python
https://redd.it/7dcpoy
Hello,
i'm pleased to announce a new release of javascripthon, the lean Python
to ES6 JavaScript translator. New in this release:
- add support for ``except`` sections with more than one exception
type and arbitrary exception variable name. Thanks to @devanlai;
- dict keys conversion fixes;
- enable ``--inline-map`` when translating a string with ``-s``;
See https://github.com/azazel75/metapensiero.pj for more info
cheers,
Alberto
/r/Python
https://redd.it/7dcpoy
GitHub
metapensiero/metapensiero.pj
Javascript for refined palates: a Python 3 to ES6 Javascript translator - metapensiero/metapensiero.pj