Python has clearly overtaken Java in popularity on StackOverflow and trails only JavaScript
https://insights.stackoverflow.com/trends?utm_source=so-owned&utm_medium=blog&utm_campaign=trends&utm_content=blog-link&tags=java%2Cpython%2Cphp%2Cjavascript
/r/Python
https://redd.it/6wmsbq
https://insights.stackoverflow.com/trends?utm_source=so-owned&utm_medium=blog&utm_campaign=trends&utm_content=blog-link&tags=java%2Cpython%2Cphp%2Cjavascript
/r/Python
https://redd.it/6wmsbq
Stackoverflow
Stack Overflow
Use Stack Overflow Insights and get information required to understand, reach, and attract developers.Improve tech hiring, recruiting, developer marketing, and and planning initiatives.
Has anyone had problems with Django settings files not interpreting environment variables correctly?
-----------------------
EDIT: Solved! Thanks /u/dirtybutter and /u/mipadi!
-----------------------
I feel like I've come across a sort of weird problem here. On my local machine, I work in virtualenvs when I am building things. Then I primarily push projects up to Heroku.
On most of my projects that are public-facing I set them up using env variables for sensitive stuff like DEBUG, SECRET_KEY, etc. Well a couple days ago I had an issue where I couldn't get debug to turn off on one of my projects on Heroku even though I had this line in my settings file:
DEBUG = bool(os.environ.get('DJANGO_DEBUG', True))
On the Heroku side, just like I always do, I set an ENV variable with the cli like so:
heroku config:set DJANGO_DEBUG=" " #Empty string evals to false
So for whatever reason that wasn't working to turn off debug on Heroku, and it seemed like Heroku wasn't interpreting it correctly because when I would print the variable using the python shell, with that same code above (i.e. bool(...)) when running bash on the Heroku dyno it would still come back as true no matter what I set it as. Finally I adjusted the settings file in my project so now it says this:
if os.environ.get('DJANGO_DEBUG') == 'True':
dbg = True
else:
dbg = False
DEBUG = dbg #bool(os.environ.get('DJANGO_DEBUG', True))
That fixed the problem on Heroku. HOWEVER, now when I run the local python server on my local machine during development, all of a sudden I can't load my static files?!?! If I set an env variable locally on my machine called DJANGO_DEBUG and set it to 'True' (note it's a STRING not a boolean) the application still has debug off. If I change the settings file back to what it originally was, DEBUG = bool(os.environ.get('DJANGO_DEBUG', True)), then my static files load again and debug acts normally, but then debug won't be interpreted right on Heroku!
So basically, my question is: WTF!?!?!?! I don't know what changed...if it's a python versioning thing, a heroku thing, or a django version thing, or something totally different. I have at least 10 other projects running on Heroku AND locally right now and I have used this syntax for years so I don't know what the hell changed or why my settings file doesn't work right on my local machine when I use the "long form" if statement, but doesn't work right on Heroku when I use the short form.
Any ideas? Thanks!!
/r/django
https://redd.it/6wl4bq
-----------------------
EDIT: Solved! Thanks /u/dirtybutter and /u/mipadi!
-----------------------
I feel like I've come across a sort of weird problem here. On my local machine, I work in virtualenvs when I am building things. Then I primarily push projects up to Heroku.
On most of my projects that are public-facing I set them up using env variables for sensitive stuff like DEBUG, SECRET_KEY, etc. Well a couple days ago I had an issue where I couldn't get debug to turn off on one of my projects on Heroku even though I had this line in my settings file:
DEBUG = bool(os.environ.get('DJANGO_DEBUG', True))
On the Heroku side, just like I always do, I set an ENV variable with the cli like so:
heroku config:set DJANGO_DEBUG=" " #Empty string evals to false
So for whatever reason that wasn't working to turn off debug on Heroku, and it seemed like Heroku wasn't interpreting it correctly because when I would print the variable using the python shell, with that same code above (i.e. bool(...)) when running bash on the Heroku dyno it would still come back as true no matter what I set it as. Finally I adjusted the settings file in my project so now it says this:
if os.environ.get('DJANGO_DEBUG') == 'True':
dbg = True
else:
dbg = False
DEBUG = dbg #bool(os.environ.get('DJANGO_DEBUG', True))
That fixed the problem on Heroku. HOWEVER, now when I run the local python server on my local machine during development, all of a sudden I can't load my static files?!?! If I set an env variable locally on my machine called DJANGO_DEBUG and set it to 'True' (note it's a STRING not a boolean) the application still has debug off. If I change the settings file back to what it originally was, DEBUG = bool(os.environ.get('DJANGO_DEBUG', True)), then my static files load again and debug acts normally, but then debug won't be interpreted right on Heroku!
So basically, my question is: WTF!?!?!?! I don't know what changed...if it's a python versioning thing, a heroku thing, or a django version thing, or something totally different. I have at least 10 other projects running on Heroku AND locally right now and I have used this syntax for years so I don't know what the hell changed or why my settings file doesn't work right on my local machine when I use the "long form" if statement, but doesn't work right on Heroku when I use the short form.
Any ideas? Thanks!!
/r/django
https://redd.it/6wl4bq
reddit
Has anyone had problems with Django settings files not... • r/django
----------------------- EDIT: Solved! Thanks /u/dirtybutter and /u/mipadi! ----------------------- I feel like I've come across a sort of weird...
MIT's introduction to CS and programming starts tomorrow. it uses python as tool to teach cs concepts.
https://www.edx.org/course/introduction-computer-science-mitx-6-00-1x-11
/r/Python
https://redd.it/6wn4ns
https://www.edx.org/course/introduction-computer-science-mitx-6-00-1x-11
/r/Python
https://redd.it/6wn4ns
edX
MITx: Introduction to Computer Science and Programming Using Python. | edX
An introduction to computer science as a tool to solve real-world analytical problems using Python 3.5.
Building this website using Flask. Feeback needed!
Hi,
I created [https://apileap.com](https://apileap.com) using Flask as the main framework and have to say that it has been an wonderful experience so far. There is a lot of nice extensions and I love being able to keep everything as simple as possible.
I do have a few questions though.
What deployment options do you recommend?
I currently use **nginx**, **gunicorn** and **gevent** on **EC2**. Do you think there are better options? How do you think I should scale if I ever need to? Anybody tried [Elastic Beanstalk](https://aws.amazon.com/elasticbeanstalk/) with Flask?
What do you think about the website? What can I improve? Do you think it might be useful?
The website offers only one API right now but the idea is to offer several easy to use APIs for small companies in the near future. Do you think it might be interesting for your company? What API would you like to see added? I was thinking about currency conversion API, IP geolocation API, phone number validation API, sms API, ...
For the curious, here are the dependencies I use:
- Flask==0.12.2
- Flask-SQLAlchemy==2.2
- Flask-Security==3.0.0
- Flask-DebugToolbar==0.10.1
- Flask-Migrate==2.0.4
- Flask-Admin==1.5.0
- SQLAlchemy==1.1.11
- gunicorn==19.7.1
- psutil==5.2.2
- gevent==1.2.2
- requests==2.18.3
- stripe==1.62.0
- websocket-client==0.44.0
- Fabric3==1.13.1.post1
And for the front end:
- jquery==3.2.1
- bootstrap==4.0.0-beta
- vue=2.4.2
Have a good day!
Tim
/r/flask
https://redd.it/6wpynb
Hi,
I created [https://apileap.com](https://apileap.com) using Flask as the main framework and have to say that it has been an wonderful experience so far. There is a lot of nice extensions and I love being able to keep everything as simple as possible.
I do have a few questions though.
What deployment options do you recommend?
I currently use **nginx**, **gunicorn** and **gevent** on **EC2**. Do you think there are better options? How do you think I should scale if I ever need to? Anybody tried [Elastic Beanstalk](https://aws.amazon.com/elasticbeanstalk/) with Flask?
What do you think about the website? What can I improve? Do you think it might be useful?
The website offers only one API right now but the idea is to offer several easy to use APIs for small companies in the near future. Do you think it might be interesting for your company? What API would you like to see added? I was thinking about currency conversion API, IP geolocation API, phone number validation API, sms API, ...
For the curious, here are the dependencies I use:
- Flask==0.12.2
- Flask-SQLAlchemy==2.2
- Flask-Security==3.0.0
- Flask-DebugToolbar==0.10.1
- Flask-Migrate==2.0.4
- Flask-Admin==1.5.0
- SQLAlchemy==1.1.11
- gunicorn==19.7.1
- psutil==5.2.2
- gevent==1.2.2
- requests==2.18.3
- stripe==1.62.0
- websocket-client==0.44.0
- Fabric3==1.13.1.post1
And for the front end:
- jquery==3.2.1
- bootstrap==4.0.0-beta
- vue=2.4.2
Have a good day!
Tim
/r/flask
https://redd.it/6wpynb
Apileap
Website screenshot and thumbnails API | ApiLeap
Best URL Screenshot API based on Chrome to make full page snapshots or thumbnails of any website. The service is fully automated and offers many options and features like mobile screenshots, custom resolution, fixed viewport, ...
What's everyone working on this week?
Tell /r/python what you're working on this week! You can be bragging, grousing, sharing your passion, or explaining your pain. Talk about your current project or your pet project; whatever you want to share.
/r/Python
https://redd.it/6wrgil
Tell /r/python what you're working on this week! You can be bragging, grousing, sharing your passion, or explaining your pain. Talk about your current project or your pet project; whatever you want to share.
/r/Python
https://redd.it/6wrgil
reddit
What's everyone working on this week? • r/Python
Tell /r/python what you're working on this week! You can be bragging, grousing, sharing your passion, or explaining your pain. Talk about your...
The Google Brain team will be back for its second AMA on September 13
Happy to announce the Google Brain team will be back in /r/MachineLearning for a second AMA on September 13. Hear how the team’s research and focuses have evolved in the past year, including updates on work in healthcare, creativity, human-AI interaction, and more.
A thread will be created before the official AMA time for those who won't be able to attend on that day.
/r/MachineLearning
https://redd.it/6wle45
Happy to announce the Google Brain team will be back in /r/MachineLearning for a second AMA on September 13. Hear how the team’s research and focuses have evolved in the past year, including updates on work in healthcare, creativity, human-AI interaction, and more.
A thread will be created before the official AMA time for those who won't be able to attend on that day.
/r/MachineLearning
https://redd.it/6wle45
reddit
The Google Brain team will be back for its... • r/MachineLearning
Happy to announce the Google Brain team will be back in /r/MachineLearning for a second AMA on September 13. Hear how the team’s research and...
I have created a collection of resources I used to learn python and Django! I'll post it here for everyone looking for a place to start!
https://mindweb.network/board/how-to-create-a-modern-website-with-django
/r/djangolearning
https://redd.it/6x0nob
https://mindweb.network/board/how-to-create-a-modern-website-with-django
/r/djangolearning
https://redd.it/6x0nob
MindWeb
How to create a modern website with Django
You want to make a website? You are new at web development.
Django Install Script for Ubuntu 16.04
Hey there, since I found this subreddit after already sharing this in the Django-subreddit, I wanna share my link to the original post here. :)
[Django Install on Ubuntu 16.04](https://www.reddit.com/r/django/comments/6wu4gu/django_install_i_am_just_a_newbie_and_i_did_this/?ref=share&ref_source=link)
Be free to comment here, or just use the real topic in /r/django as posted above.
/r/djangolearning
https://redd.it/6wxdxl
Hey there, since I found this subreddit after already sharing this in the Django-subreddit, I wanna share my link to the original post here. :)
[Django Install on Ubuntu 16.04](https://www.reddit.com/r/django/comments/6wu4gu/django_install_i_am_just_a_newbie_and_i_did_this/?ref=share&ref_source=link)
Be free to comment here, or just use the real topic in /r/django as posted above.
/r/djangolearning
https://redd.it/6wxdxl
reddit
[Django Install] I am just a newbie and I did this for... • r/django
I just did [this](https://pastebin.com/9vnMQrnQ) after figuring out, how to install Python and Django on Ubuntu 16.04 based on the Django-Tutorial...
User Authentication with Angular 4 and Flask
https://realpython.com/blog/python/user-authentication-with-angular-4-and-flask#.WaVoDXfW35M.reddit
/r/flask
https://redd.it/6wr4f0
https://realpython.com/blog/python/user-authentication-with-angular-4-and-flask#.WaVoDXfW35M.reddit
/r/flask
https://redd.it/6wr4f0
Realpython
User Authentication With Angular 4 and Flask – Real Python
Here we look at how to handle user authentication using JSON Web Tokens with Angular and Flask.
Learn Python For Data Science And Machine Learning With Jose Portilla
https://medium.com/@amtoddstewart/learn-python-for-data-science-and-machine-learning-with-jose-portilla-1445beddf345
/r/Python
https://redd.it/6wzk2l
https://medium.com/@amtoddstewart/learn-python-for-data-science-and-machine-learning-with-jose-portilla-1445beddf345
/r/Python
https://redd.it/6wzk2l
Medium
Learn Python For Data Science And Machine Learning With Jose Portilla
You will learn to use NumPy, Pandas, Seaborn, Matplotlib, Plotly, Scikit-Learn, Machine Learning, Tensorflow, and much more
Pynesis, a basic high level AWS Kinesis client for Python
https://github.com/ticketea/pynesis
/r/Python
https://redd.it/6wyl3q
https://github.com/ticketea/pynesis
/r/Python
https://redd.it/6wyl3q
GitHub
ticketea/pynesis
High level python library for using kinesis streams - ticketea/pynesis
Django Migration Don’ts – edX Engineering
https://engineering.edx.org/django-migration-donts-f4588fd11b64
/r/django
https://redd.it/6wyitx
https://engineering.edx.org/django-migration-donts-f4588fd11b64
/r/django
https://redd.it/6wyitx
reddit
Django Migration Don’ts – edX Engineering • r/django
15 points and 10 comments so far on reddit
Python 2.7.14rc1 released
https://mail.python.org/pipermail/python-dev/2017-August/148992.html
/r/Python
https://redd.it/6x1sfm
https://mail.python.org/pipermail/python-dev/2017-August/148992.html
/r/Python
https://redd.it/6x1sfm
[P] Deepmind's StarCraft II RL Tutorial 1
http://chris-chris.ai/2017/08/30/pysc2-tutorial1/
/r/MachineLearning
https://redd.it/6x5284
http://chris-chris.ai/2017/08/30/pysc2-tutorial1/
/r/MachineLearning
https://redd.it/6x5284
reddit
[P] Deepmind's StarCraft II RL Tutorial 1 • r/MachineLearning
25 points and 3 comments so far on reddit
How dos createview trigger saving the model?
Digging through parts of the django 1.6 code (dont ask...) i was not able to find out how the basic CreateView issues saving the model, as is stated in its documentation (https://docs.djangoproject.com/en/1.11/ref/class-based-views/generic-editing/#django.views.generic.edit.CreateView)
Possibly (and hopefully) related things ive found out:
* CreateView's super classes dont handle saving in any way
* BaseModelForm seems to be the only part where the model instance of a form is pulled and actually saved
* BaseInlineFormSet has a save method, that actually calls save on a form, but i was not able to find out how that is related to actual forms, since most forms just inherit from Form, and not BaseModelForm...
Can someone please explain to me how all this works together?
/r/djangolearning
https://redd.it/6x363z
Digging through parts of the django 1.6 code (dont ask...) i was not able to find out how the basic CreateView issues saving the model, as is stated in its documentation (https://docs.djangoproject.com/en/1.11/ref/class-based-views/generic-editing/#django.views.generic.edit.CreateView)
Possibly (and hopefully) related things ive found out:
* CreateView's super classes dont handle saving in any way
* BaseModelForm seems to be the only part where the model instance of a form is pulled and actually saved
* BaseInlineFormSet has a save method, that actually calls save on a form, but i was not able to find out how that is related to actual forms, since most forms just inherit from Form, and not BaseModelForm...
Can someone please explain to me how all this works together?
/r/djangolearning
https://redd.it/6x363z
reddit
How dos createview trigger saving the model? • r/djangolearning
Digging through parts of the django 1.6 code (dont ask...) i was not able to find out how the basic CreateView issues saving the model, as is...
Tags for post
I was thinking if we can create tags for all the awesome resources that are shared on this sub?
For example we could have a tag for e books, online free courses, sample projects. Would be more than happy to contribute.
/r/Python
https://redd.it/6x5nol
I was thinking if we can create tags for all the awesome resources that are shared on this sub?
For example we could have a tag for e books, online free courses, sample projects. Would be more than happy to contribute.
/r/Python
https://redd.it/6x5nol
reddit
Tags for post • r/Python
I was thinking if we can create tags for all the awesome resources that are shared on this sub? For example we could have a tag for e books,...
What are the biggest drawbacks/cons of Python? And why choosing Python over JavaScript?
I want to be a Pentester (and It is my focus) and I like making the Front end side of websites and videogames. With JavaScript I can be a Frontend Developer and making games even for mobile thanks to React Native,Cordova and Ionic and inject Javascript on websites and many other things.
Actually I am interested on knowing more on Python and use It as a main language, but everyone say Python is only a "glue" language,It isn't easily scalable and maintainable than languages like Java and it isn't very suitable for concurrency and other things because it is slow.
On the other hand, I heard people very enthusiastic about Python and this language can do everything,but it is true?
Is Python more than a replacement of Bash?
Thank you!
/r/Python
https://redd.it/6x6oji
I want to be a Pentester (and It is my focus) and I like making the Front end side of websites and videogames. With JavaScript I can be a Frontend Developer and making games even for mobile thanks to React Native,Cordova and Ionic and inject Javascript on websites and many other things.
Actually I am interested on knowing more on Python and use It as a main language, but everyone say Python is only a "glue" language,It isn't easily scalable and maintainable than languages like Java and it isn't very suitable for concurrency and other things because it is slow.
On the other hand, I heard people very enthusiastic about Python and this language can do everything,but it is true?
Is Python more than a replacement of Bash?
Thank you!
/r/Python
https://redd.it/6x6oji
reddit
What are the biggest drawbacks/cons of Python? And why... • r/Python
I want to be a Pentester (and It is my focus) and I like making the Front end side of websites and videogames. With JavaScript I can be a Frontend...
silly question about sessions
I'm using sessions in a current django project and recently got a 'Object of type 'date' is not JSON serializable' error.
Reading through the django docs on sessions I'm not clear why sessions use a serializer?
(I'm using the db to store the session)
From my understanding isn't just the session ID going to the browser in a cookie and the session data is stored in the db? The data in the session can be accessed via the ORM like a normal model. However when I look at the database table there is just one field, session_data (apart from expiry date and session id). Looking at the docs seems to be signed (but not encrypted? - not sure of the difference). So I'm not clear where the serializer is being used?
Additionally I was using django wizard before which stores intermediate data (such as the field causing the date issue above) in the session. I've now switched that part of the app to use seperate views for flexibility (signup wasn't just a linear path), but now have the 'not JSON serializable' error, how does django wizard get round this?
/r/djangolearning
https://redd.it/6x70xe
I'm using sessions in a current django project and recently got a 'Object of type 'date' is not JSON serializable' error.
Reading through the django docs on sessions I'm not clear why sessions use a serializer?
(I'm using the db to store the session)
From my understanding isn't just the session ID going to the browser in a cookie and the session data is stored in the db? The data in the session can be accessed via the ORM like a normal model. However when I look at the database table there is just one field, session_data (apart from expiry date and session id). Looking at the docs seems to be signed (but not encrypted? - not sure of the difference). So I'm not clear where the serializer is being used?
Additionally I was using django wizard before which stores intermediate data (such as the field causing the date issue above) in the session. I've now switched that part of the app to use seperate views for flexibility (signup wasn't just a linear path), but now have the 'not JSON serializable' error, how does django wizard get round this?
/r/djangolearning
https://redd.it/6x70xe
reddit
silly question about sessions • r/djangolearning
I'm using sessions in a current django project and recently got a 'Object of type 'date' is not JSON serializable' error. Reading through the...
Search form with ManyToManyFields
I am creating a basic CRUD application using Django for the first time. I would love to have some guidance and direction regarding how to add a search form.
I need to create a search form for a `ServiceProvider` model. The search form has three text boxes to search for service providers by any or all of `location`, `memberships` and `expertise`. The latter two search fields are of `ManyToManyField` type.
These are the model definitions I have:
class ServiceProvider(models.Model):
provider_name = models.CharField(max_length=200)
created_date = models.DateTimeField(default=timezone.now)
# SEARCH FIELDS ->
location = models.CharField(max_length=100)
memberships = models.ManyToManyField(Memberships)
expertise = models.ManyToManyField(SkillAreas)
class Memberships(models.Model):
membership_name = models.CharField(max_length=200)
membership_description = models.TextField(blank=True, null=True)
class SkillAreas(models.Model):
skill_name = models.CharField(max_length=200)
skill_description = models.TextField(blank=True, null=True)
Though `memberships` is a multi select field in the backend, in the search field, user can only type one skill at the moment. Same goes for `expertise` field. How should I go about adding a search form for this `ServiceProvider`?
I found a solution for search for multiple fields in a stackoverflow [answer](https://stackoverflow.com/a/26640293): [Adding search to a Django site in a snap](https://www.julienphalip.com/blog/adding-search-to-a-django-site-in-a-snap/). In this solution, I didn't quite understand what Q is. Does this solution fit my need at all?
I also learned that there is something called `django-haystack`, but it feels a bit complex than the above solution and also I am not sure if it fits my need. Thanks in advance.
/r/djangolearning
https://redd.it/6wae1j
I am creating a basic CRUD application using Django for the first time. I would love to have some guidance and direction regarding how to add a search form.
I need to create a search form for a `ServiceProvider` model. The search form has three text boxes to search for service providers by any or all of `location`, `memberships` and `expertise`. The latter two search fields are of `ManyToManyField` type.
These are the model definitions I have:
class ServiceProvider(models.Model):
provider_name = models.CharField(max_length=200)
created_date = models.DateTimeField(default=timezone.now)
# SEARCH FIELDS ->
location = models.CharField(max_length=100)
memberships = models.ManyToManyField(Memberships)
expertise = models.ManyToManyField(SkillAreas)
class Memberships(models.Model):
membership_name = models.CharField(max_length=200)
membership_description = models.TextField(blank=True, null=True)
class SkillAreas(models.Model):
skill_name = models.CharField(max_length=200)
skill_description = models.TextField(blank=True, null=True)
Though `memberships` is a multi select field in the backend, in the search field, user can only type one skill at the moment. Same goes for `expertise` field. How should I go about adding a search form for this `ServiceProvider`?
I found a solution for search for multiple fields in a stackoverflow [answer](https://stackoverflow.com/a/26640293): [Adding search to a Django site in a snap](https://www.julienphalip.com/blog/adding-search-to-a-django-site-in-a-snap/). In this solution, I didn't quite understand what Q is. Does this solution fit my need at all?
I also learned that there is something called `django-haystack`, but it feels a bit complex than the above solution and also I am not sure if it fits my need. Thanks in advance.
/r/djangolearning
https://redd.it/6wae1j
Stackoverflow
How can I make Django search in multiple fields using QuerySets and MySql "Full Text Search"?
I'm a Django novice, trying to create a "Search" form for my project using MySql with MyISAM engine. So far, I manage to get the form to work, but Django doesn't seem to search all fields the same ...