[AF] Avoiding "mixed content" when running Flask app in Docker container
I've been working on an application that uses Flask as a RESTful API which is consumed by a Vue.js front-end. I've just finished converting everything into 3 seperate Docker containers: One for Flask ([Built using this as my base image](https://github.com/tiangolo/meinheld-gunicorn-flask-docker)), one for the front-end, and one for MySQL. Everything is configured for access by reverse proxy using nginx, which is where I do all of my SSL termination.
In my initial testing, I'm able to send and receive data from my API endpoints using curl / Invoke-RestMethod just fine. However, when trying to go through the front-end, the browsers I've tested on complain about data coming from the API as not being encrypted. As a result, my login screen which depends on getting a session token back from the API won't work. My nginx configuration is set up so any requests for http:// / 80 get redirected to 443. The requests are then proxy-passed to each corresponding container which is mapped to port 80 on the inside. All of my API calls in the front-end reference https:// in their paths.
Is this is something I can fix in gunicorn / Flask, or do I need to modify my nginx
/r/flask
https://redd.it/alwrb8
I've been working on an application that uses Flask as a RESTful API which is consumed by a Vue.js front-end. I've just finished converting everything into 3 seperate Docker containers: One for Flask ([Built using this as my base image](https://github.com/tiangolo/meinheld-gunicorn-flask-docker)), one for the front-end, and one for MySQL. Everything is configured for access by reverse proxy using nginx, which is where I do all of my SSL termination.
In my initial testing, I'm able to send and receive data from my API endpoints using curl / Invoke-RestMethod just fine. However, when trying to go through the front-end, the browsers I've tested on complain about data coming from the API as not being encrypted. As a result, my login screen which depends on getting a session token back from the API won't work. My nginx configuration is set up so any requests for http:// / 80 get redirected to 443. The requests are then proxy-passed to each corresponding container which is mapped to port 80 on the inside. All of my API calls in the front-end reference https:// in their paths.
Is this is something I can fix in gunicorn / Flask, or do I need to modify my nginx
/r/flask
https://redd.it/alwrb8
GitHub
GitHub - tiangolo/meinheld-gunicorn-flask-docker: Docker image with Meinheld and Gunicorn for Flask applications in Python.
Docker image with Meinheld and Gunicorn for Flask applications in Python. - tiangolo/meinheld-gunicorn-flask-docker
This media is not supported in your browser
VIEW IN TELEGRAM
[Pytorch+OpenCV] My implementation of QuickDraw - an online game developed by Google (Source code: https://github.com/vietnguyen91/QuickDraw)
/r/IPython
https://redd.it/am0366
/r/IPython
https://redd.it/am0366
Suggestions for junior developers to move step forward
Hello, is there any suggestions for a junior developer?
As a junior Python/Django developer, I am searching ways to improve myself, but I am a bit confused. I think I learned most of the technical details of Django, but I am struggling about architectural design of a project and tech stacks to choose for it. What are your suggestions for a newbie like me? Learning different technologies(docker, graphql etc.) or adding some front end skills?
/r/django
https://redd.it/am2hrv
Hello, is there any suggestions for a junior developer?
As a junior Python/Django developer, I am searching ways to improve myself, but I am a bit confused. I think I learned most of the technical details of Django, but I am struggling about architectural design of a project and tech stacks to choose for it. What are your suggestions for a newbie like me? Learning different technologies(docker, graphql etc.) or adding some front end skills?
/r/django
https://redd.it/am2hrv
reddit
r/django - Suggestions for junior developers to move step forward
1 vote and 0 comments so far on Reddit
Made use of my Python knowledge professionally for the first time!
I’m a mechanical engineer, but love learning new things. In the last few years, I’ve taken several edX courses on python, and loved learning about it. I generally just tinker around keeping the basics fresh, but recently I had an opportunity to speed up some data analysis at work, and was able to use python to do it!
As part of our testing, we generate some large csv files (generally 1-4 gb), which were a real pain in the ass to work with in excel. Using python and pandas, I wrote a short piece of code (200 lines) to parse our data, strip out the junk, and plot it into a presentable form. Now there are like 5 people using it on a regular basis!
This is a big deal for me so I wanted to share it. Even dumb mech e’s can use computers!
/r/Python
https://redd.it/am0opt
I’m a mechanical engineer, but love learning new things. In the last few years, I’ve taken several edX courses on python, and loved learning about it. I generally just tinker around keeping the basics fresh, but recently I had an opportunity to speed up some data analysis at work, and was able to use python to do it!
As part of our testing, we generate some large csv files (generally 1-4 gb), which were a real pain in the ass to work with in excel. Using python and pandas, I wrote a short piece of code (200 lines) to parse our data, strip out the junk, and plot it into a presentable form. Now there are like 5 people using it on a regular basis!
This is a big deal for me so I wanted to share it. Even dumb mech e’s can use computers!
/r/Python
https://redd.it/am0opt
reddit
r/Python - Made use of my Python knowledge professionally for the first time!
331 votes and 60 comments so far on Reddit
Flask API Authentication
Looking at various Flask API Authentications.
I am wondering what is recommended for production.
​
Looking at a mock up using [Flask-JWT-Extended](https://github.com/vimalloc/flask-jwt-extended), any thoughts on this or any other recommendations?
/r/flask
https://redd.it/am2d56
Looking at various Flask API Authentications.
I am wondering what is recommended for production.
​
Looking at a mock up using [Flask-JWT-Extended](https://github.com/vimalloc/flask-jwt-extended), any thoughts on this or any other recommendations?
/r/flask
https://redd.it/am2d56
GitHub
GitHub - vimalloc/flask-jwt-extended: An open source Flask extension that provides JWT support (with batteries included)!
An open source Flask extension that provides JWT support (with batteries included)! - vimalloc/flask-jwt-extended
How to host dynamically generated images in Google Cloud Storage?
Hi there, I've been trying to figure this out for hours, bouncing from tutorial to tutorial, so I thought I'd post it here in hopes someone might be able to give me some simple pointers:
​
I have a Django project that uses PyGal to generate some nice looking sag charts to use in a report we're creating, using `return self.chart.render_to_file(settings.STATIC_ROOT + 'myapp/graphs/graph.svg')`. The charts are saved to disk and then loaded into the Django templates for the report, which is then converted to PDF using PyGal.
​
This works fine developing locally, it updates the file overwriting if need be, and the HTML references it fine. However, as I begin to look at deployment and experiment with that, I still haven't been able to get it working running Google Cloud.
​
My Google Cloud setup is: Django is running in a container on Kubernetes, database is Google's CloudSQL MySQ, and I have a storage bucket called `myapp-production-static` where I serve static files from. This works fine for static files (images, css, etc), however, I can't for the life of me figure out how to get Django to write the chart.svg files into the storage container that STATIC is successfully pointing at.
​
Has anyone else successfully done
/r/djangolearning
https://redd.it/alzqem
Hi there, I've been trying to figure this out for hours, bouncing from tutorial to tutorial, so I thought I'd post it here in hopes someone might be able to give me some simple pointers:
​
I have a Django project that uses PyGal to generate some nice looking sag charts to use in a report we're creating, using `return self.chart.render_to_file(settings.STATIC_ROOT + 'myapp/graphs/graph.svg')`. The charts are saved to disk and then loaded into the Django templates for the report, which is then converted to PDF using PyGal.
​
This works fine developing locally, it updates the file overwriting if need be, and the HTML references it fine. However, as I begin to look at deployment and experiment with that, I still haven't been able to get it working running Google Cloud.
​
My Google Cloud setup is: Django is running in a container on Kubernetes, database is Google's CloudSQL MySQ, and I have a storage bucket called `myapp-production-static` where I serve static files from. This works fine for static files (images, css, etc), however, I can't for the life of me figure out how to get Django to write the chart.svg files into the storage container that STATIC is successfully pointing at.
​
Has anyone else successfully done
/r/djangolearning
https://redd.it/alzqem
reddit
r/djangolearning - How to host dynamically generated images in Google Cloud Storage?
1 vote and 0 comments so far on Reddit
This media is not supported in your browser
VIEW IN TELEGRAM
[Pytorch+OpenCV] My implementation of QuickDraw - an online game developed by Google (Source code: https://github.com/vietnguyen91/QuickDraw)
/r/Python
https://redd.it/am30wd
/r/Python
https://redd.it/am30wd
how to use a django form to update 2 related tables.
​
Hi guys,
​
I'm very new to python and django, I started django about a week ago. So far things seem quite straight forward, however I'm stuck on a concept and could do with some advice on best way to proceed.
​
I've decided for a first django project to make a cooking recipe for my wife. probably a bit ambitious for a first project but its all good learning :D
class Ingredients(models.Model):
name = models.TextField()
def __str__(self):
return self.name
class Category(models.Model):
food_category_name = models.TextField()
class Recipe(models.Model):
food_category = models.ForeignKey(Category, on_delete=models.CASCADE)
recipe_name = models.TextField()
recipe_description = models.TextField()
picture_item
/r/djangolearning
https://redd.it/am5t18
​
Hi guys,
​
I'm very new to python and django, I started django about a week ago. So far things seem quite straight forward, however I'm stuck on a concept and could do with some advice on best way to proceed.
​
I've decided for a first django project to make a cooking recipe for my wife. probably a bit ambitious for a first project but its all good learning :D
class Ingredients(models.Model):
name = models.TextField()
def __str__(self):
return self.name
class Category(models.Model):
food_category_name = models.TextField()
class Recipe(models.Model):
food_category = models.ForeignKey(Category, on_delete=models.CASCADE)
recipe_name = models.TextField()
recipe_description = models.TextField()
picture_item
/r/djangolearning
https://redd.it/am5t18
reddit
r/djangolearning - how to use a django form to update 2 related tables.
2 votes and 2 comments so far on Reddit
[P] Browse State-of-the-Art Papers with Code
[https://paperswithcode.com/sota](https://paperswithcode.com/sota)
Hi all,
We’ve just released the latest version of Papers With Code. As part of this we’ve extracted 950+ unique ML tasks, 500+ evaluation tables (with state of the art results) and 8500+ papers with code. We’ve also open-sourced the entire dataset.
Everything on the site is editable and versioned. We’ve found the tasks and state-of-the-art data really informative to discover and compare research - and even found some research gems that we didn’t know about before. Feel free to join us in annotating and discussing papers!
Let us know your thoughts.
Thanks!
Robert
/r/MachineLearning
https://redd.it/am1yeq
[https://paperswithcode.com/sota](https://paperswithcode.com/sota)
Hi all,
We’ve just released the latest version of Papers With Code. As part of this we’ve extracted 950+ unique ML tasks, 500+ evaluation tables (with state of the art results) and 8500+ papers with code. We’ve also open-sourced the entire dataset.
Everything on the site is editable and versioned. We’ve found the tasks and state-of-the-art data really informative to discover and compare research - and even found some research gems that we didn’t know about before. Feel free to join us in annotating and discussing papers!
Let us know your thoughts.
Thanks!
Robert
/r/MachineLearning
https://redd.it/am1yeq
huggingface.co
Trending Papers - Hugging Face
Your daily dose of AI research from AK
I have two days to deliver my first internship challenge and I can't get my Update view to load the proper instance when using Bootstrap modal. Any help appreciated.
https://old.reddit.com/r/djangolearning/comments/amayrg/i_have_two_days_to_deliver_my_first_internship/
/r/django
https://redd.it/amb6fp
https://old.reddit.com/r/djangolearning/comments/amayrg/i_have_two_days_to_deliver_my_first_internship/
/r/django
https://redd.it/amb6fp
reddit
r/djangolearning - I have two days to deliver my first internship challenge and I can't get my Update view to load the proper instance…
1 vote and 0 comments so far on Reddit
Python ad on reddit contains only JavaScript code. Zoom on the code inside Python.
/r/Python
https://redd.it/am7kqs
/r/Python
https://redd.it/am7kqs
Questions about flask html rendering.
I started web development with flask, with all server side routing and rendering. Now I am in the process of learning single page with react where flask (I think) renders only the first page then after that returns only JSON. So my question is, have I progressed as a programmer? i.e. will I mostly use flask like this now, as an api? Or are there situations where I might create a modified single page where I still render some pages with flask, and along with that still use jinja2, flask_wtf, flask_login, etc... the bulk of the flask extensions that I have learned thus far?
/r/flask
https://redd.it/ambsoh
I started web development with flask, with all server side routing and rendering. Now I am in the process of learning single page with react where flask (I think) renders only the first page then after that returns only JSON. So my question is, have I progressed as a programmer? i.e. will I mostly use flask like this now, as an api? Or are there situations where I might create a modified single page where I still render some pages with flask, and along with that still use jinja2, flask_wtf, flask_login, etc... the bulk of the flask extensions that I have learned thus far?
/r/flask
https://redd.it/ambsoh
reddit
r/flask - Questions about flask html rendering.
2 votes and 1 comment so far on Reddit
Django CMS - add Placeholderfield with TextPlugin from script
Hi reddit,
My friend have a blog on old django cms 2.X
I'm trying to help him automate some stuff, like create post in dropbox paper and export it to html with all text formatting stuff, and add it as a draft to his blog.
And my problem is :
How can i get instance of PlaceholderField, and add 'TextPlugin" in it from outside script
Models looks something like this :
class Post(models.Model):
author = models.ForeignKey(Author, verbose_name=_("Author"), blank=True, null=True)
........
draft = models.BooleanField(default=True)
class PostData(models.Model):
post = models.ForeignKey(Post, verbose_name=_("Post"))
post_content = PlaceholderField('Posts Content',related_name="%(app_label)s_%(class)s_posts_content")
......
My script is simple as f:
html_data = """<b>formatted html from dropbox paper</b>"""
author = Author.objects.get(id=1)
new_post = Post(author=author,draft=True, ...)
new_post.save()
post_data = PostData(post=new_post,language='en', post_content=???????)
I've read somewhere to override save method in PostData ie:
/r/django
https://redd.it/am8wex
Hi reddit,
My friend have a blog on old django cms 2.X
I'm trying to help him automate some stuff, like create post in dropbox paper and export it to html with all text formatting stuff, and add it as a draft to his blog.
And my problem is :
How can i get instance of PlaceholderField, and add 'TextPlugin" in it from outside script
Models looks something like this :
class Post(models.Model):
author = models.ForeignKey(Author, verbose_name=_("Author"), blank=True, null=True)
........
draft = models.BooleanField(default=True)
class PostData(models.Model):
post = models.ForeignKey(Post, verbose_name=_("Post"))
post_content = PlaceholderField('Posts Content',related_name="%(app_label)s_%(class)s_posts_content")
......
My script is simple as f:
html_data = """<b>formatted html from dropbox paper</b>"""
author = Author.objects.get(id=1)
new_post = Post(author=author,draft=True, ...)
new_post.save()
post_data = PostData(post=new_post,language='en', post_content=???????)
I've read somewhere to override save method in PostData ie:
/r/django
https://redd.it/am8wex
reddit
r/django - Django CMS - add Placeholderfield with TextPlugin from script
2 votes and 0 comments so far on Reddit
[1901.11390] MONet: Unsupervised Scene Decomposition and Representation
https://arxiv.org/abs/1901.11390
/r/MachineLearning
https://redd.it/am76v7
https://arxiv.org/abs/1901.11390
/r/MachineLearning
https://redd.it/am76v7
arXiv.org
MONet: Unsupervised Scene Decomposition and Representation
The ability to decompose scenes in terms of abstract building blocks is crucial for general intelligence. Where those basic building blocks share meaningful properties, interactions and other...
Building a Browsable Web API project using The Django-Rest Framework
https://www.reddit.com/r/djangolearning/comments/am95u2/building_a_browsable_web_api_project_using_the/
/r/django
https://redd.it/am990m
https://www.reddit.com/r/djangolearning/comments/am95u2/building_a_browsable_web_api_project_using_the/
/r/django
https://redd.it/am990m
reddit
r/djangolearning - Building a Browsable Web API project using The Django-Rest Framework
2 votes and 3 comments so far on Reddit
stupid question
How do i describe django?
So typically html and css are front end and java script is backend?
but with django html and css are front end and django python is backend?
I feel like im completely wrong i probably am
/r/django
https://redd.it/amdmhn
How do i describe django?
So typically html and css are front end and java script is backend?
but with django html and css are front end and django python is backend?
I feel like im completely wrong i probably am
/r/django
https://redd.it/amdmhn
reddit
r/django - stupid question
3 votes and 4 comments so far on Reddit
[1901.06955v1] Deep Neural Network Approximation for Custom Hardware: Where We've Been, Where We're Going
https://arxiv.org/abs/1901.06955v1
/r/MachineLearning
https://redd.it/amedjh
https://arxiv.org/abs/1901.06955v1
/r/MachineLearning
https://redd.it/amedjh
arXiv.org
Deep Neural Network Approximation for Custom Hardware: Where...
Deep neural networks have proven to be particularly effective in visual and
audio recognition tasks. Existing models tend to be computationally expensive
and memory intensive, however, and so...
audio recognition tasks. Existing models tend to be computationally expensive
and memory intensive, however, and so...
Trouble with HTMLCalendar
I'm having trouble with setting the first day within an HTMLCalendar to Sunday. Here is my code:
​
I'd like to make Sunday the first day in my calendar, but I'm not sure how to. I know that calendar.setfirstweekday() is a method that can be used for calendars, but I don't know that it's available for HTMLCalendar.
**utils.py**
class Calendar(HTMLCalendar):
def __init__(self, year=None, month=None, user=None):
self.year = year
self.month = month
self.user = user
super(Calendar, self).__init__()
Views.py
class CalendarView(generic.ListView):
model = Event
template_name = 'accounts/calendar.html'
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
/r/django
https://redd.it/amafsc
I'm having trouble with setting the first day within an HTMLCalendar to Sunday. Here is my code:
​
I'd like to make Sunday the first day in my calendar, but I'm not sure how to. I know that calendar.setfirstweekday() is a method that can be used for calendars, but I don't know that it's available for HTMLCalendar.
**utils.py**
class Calendar(HTMLCalendar):
def __init__(self, year=None, month=None, user=None):
self.year = year
self.month = month
self.user = user
super(Calendar, self).__init__()
Views.py
class CalendarView(generic.ListView):
model = Event
template_name = 'accounts/calendar.html'
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
/r/django
https://redd.it/amafsc
reddit
r/django - Trouble with HTMLCalendar
0 votes and 2 comments so far on Reddit
This media is not supported in your browser
VIEW IN TELEGRAM
ASCII generator (image2text, image2image and video2video) written in Python (Github repo: https://github.com/vietnguyen91/ASCII-generator)
/r/Python
https://redd.it/amfbjz
/r/Python
https://redd.it/amfbjz
what the best way to write/run a js test with django?
I'm using bootstrap (inc jquery depedency) on the front end together will full stack django. I'm used to just writing tests for django, but currently I need to write one to test a bootstrap modal is working. (it no longer works for some reason).
What's the best way to do this?
​
Thanks,
/r/django
https://redd.it/am3wbl
I'm using bootstrap (inc jquery depedency) on the front end together will full stack django. I'm used to just writing tests for django, but currently I need to write one to test a bootstrap modal is working. (it no longer works for some reason).
What's the best way to do this?
​
Thanks,
/r/django
https://redd.it/am3wbl
reddit
r/django - what the best way to write/run a js test with django?
0 votes and 12 comments so far on Reddit