Django best practices to pass user groups to client side
Hey Django devs!
I'm fairly new to django, I'm currently building an app that has users that belong to different groups, the client side app has different behavior depending on the user groups, so all the scripts on the site should be able to figure out to what groups the user belongs to. I'm currently dynamically adding the groups to a script with a global scope so that all other scripts can access the groups, but I feel like there has to be a better way to do this, any ideas? Any way to store those values in a cookie from django and then accesing it with the js?
/r/django
https://redd.it/7bucao
Hey Django devs!
I'm fairly new to django, I'm currently building an app that has users that belong to different groups, the client side app has different behavior depending on the user groups, so all the scripts on the site should be able to figure out to what groups the user belongs to. I'm currently dynamically adding the groups to a script with a global scope so that all other scripts can access the groups, but I feel like there has to be a better way to do this, any ideas? Any way to store those values in a cookie from django and then accesing it with the js?
/r/django
https://redd.it/7bucao
reddit
Django best practices to pass user groups to client side • r/django
Hey Django devs! I'm fairly new to django, I'm currently building an app that has users that belong to different groups, the client side...
Settings.py for sending emails
Rather new to programming. I want to set up a simple form which will send it's content to an admin's email. What I'm failing to understand is what happens in settings.py. I have:
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'name@gmail.com'
EMAIL_HOST_PASSWORD = 'password' #
EMAIL_PORT = 587
EMAIL_USE_TLS = True
My questions are:
1. Is EMAIL_HOST_USER referring to the admin's email?
2. In EMAIL_HOST_PASSWORD should I write the password with which the admin connects to his email (related to this, I've found a suggestion for gmail accounts to use [DisplayUnlockCaptcha](https://accounts.google.com/DisplayUnlockCaptcha), added a new app, and a code was generated. Must that be copy-pasted at EMAIL_HOST_PASSWORD?)
3. What's with the EMAIL_PORT? How do I know which one works for me?
/r/djangolearning
https://redd.it/7bh60t
Rather new to programming. I want to set up a simple form which will send it's content to an admin's email. What I'm failing to understand is what happens in settings.py. I have:
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'name@gmail.com'
EMAIL_HOST_PASSWORD = 'password' #
EMAIL_PORT = 587
EMAIL_USE_TLS = True
My questions are:
1. Is EMAIL_HOST_USER referring to the admin's email?
2. In EMAIL_HOST_PASSWORD should I write the password with which the admin connects to his email (related to this, I've found a suggestion for gmail accounts to use [DisplayUnlockCaptcha](https://accounts.google.com/DisplayUnlockCaptcha), added a new app, and a code was generated. Must that be copy-pasted at EMAIL_HOST_PASSWORD?)
3. What's with the EMAIL_PORT? How do I know which one works for me?
/r/djangolearning
https://redd.it/7bh60t
reddit
Settings.py for sending emails • r/djangolearning
Rather new to programming. I want to set up a simple form which will send it's content to an admin's email. What I'm failing to understand is what...
Start Getting and Working with Data with "Data Acquisition and Manipulation with Python"
https://ntguardian.wordpress.com/2017/11/09/start-getting-and-working-with-data-with-data-acquisition-and-manipulation-with-python/
/r/pystats
https://redd.it/7bxw50
https://ntguardian.wordpress.com/2017/11/09/start-getting-and-working-with-data-with-data-acquisition-and-manipulation-with-python/
/r/pystats
https://redd.it/7bxw50
Curtis Miller's Personal Website
Start Getting and Working with Data with “Data Acquisition and Manipulation with Python”
I announce my video course Data Acquisition and Manipulation with Python.
Exploring Line Lengths in Python Packages, Pythonic Perambulations, Jake Vanderplas
http://jakevdp.github.io/blog/2017/11/09/exploring-line-lengths-in-python-packages/
/r/Python
https://redd.it/7byr3j
http://jakevdp.github.io/blog/2017/11/09/exploring-line-lengths-in-python-packages/
/r/Python
https://redd.it/7byr3j
reddit
Exploring Line Lengths in Python Packages, Pythonic... • r/Python
66 points and 3 comments so far on reddit
Machine Learning With Python – Introduction
http://devarea.com/machine-learning-with-python-introduction/
/r/Python
https://redd.it/7c01v3
http://devarea.com/machine-learning-with-python-introduction/
/r/Python
https://redd.it/7c01v3
I eventually want to port my Django web site/app over to mobile. Is it necessary that I incorporate DRF ASAP?
It'll be for both the browser and mobile.
I decided browser first, though, since I've already invested quite a bit of time into it.
From my understanding, adding an API using DRF would *not* mean a complete rewrite of my current class-based-view django app. Instead, it only means an addition of new code--"api" folder, serializers, new url routes, etc.
Is this actually the case? Can I freely continue working on the browser version and simply add DRF for mobile later down the line?
If so, how does this change if I decide to add a frontend framework to my browser such as React?
React may also be frontend framework of choice for mobile given React Native.
But if this isn't the case, should I have started with DRF? What considerations should I make now to ensure that the eventual browser-mobile porting works out?
/r/django
https://redd.it/7bz6vc
It'll be for both the browser and mobile.
I decided browser first, though, since I've already invested quite a bit of time into it.
From my understanding, adding an API using DRF would *not* mean a complete rewrite of my current class-based-view django app. Instead, it only means an addition of new code--"api" folder, serializers, new url routes, etc.
Is this actually the case? Can I freely continue working on the browser version and simply add DRF for mobile later down the line?
If so, how does this change if I decide to add a frontend framework to my browser such as React?
React may also be frontend framework of choice for mobile given React Native.
But if this isn't the case, should I have started with DRF? What considerations should I make now to ensure that the eventual browser-mobile porting works out?
/r/django
https://redd.it/7bz6vc
reddit
I eventually want to port my Django web site/app over... • r/django
It'll be for both the browser and mobile. I decided browser first, though, since I've already invested quite a bit of time into it. From my...
Django UnboundLocalError when submitting an empty form
Hello, I'm new to django and I'm trying to build something. I made a form for users to comment on a post and it works well but when I tried to submit the form without any content there was a big error on the screen which says I've referenced a local variable before assignment. Can anybody tell me how to fix that?? I'll be very thankful.
/r/djangolearning
https://redd.it/7c00ry
Hello, I'm new to django and I'm trying to build something. I made a form for users to comment on a post and it works well but when I tried to submit the form without any content there was a big error on the screen which says I've referenced a local variable before assignment. Can anybody tell me how to fix that?? I'll be very thankful.
/r/djangolearning
https://redd.it/7c00ry
reddit
Django UnboundLocalError when submitting an... • r/djangolearning
Hello, I'm new to django and I'm trying to build something. I made a form for users to comment on a post and it works well but when I tried to...
A Python library for particle swarm optimization
Hi! Few months ago I shared a very simple project in this sub, and thanks to your suggestions and comments, I learned a lot and was able to transform (or "overhaul") it into a full package. First off, thank you very much!
I would like to present [PySwarms](https://github.com/ljvmiranda921/pyswarms), a Python library for particle swarm optimization. Aside from performing basic optimization, you can inspect the behavior of your swarm and even look for the best hyper-parameters to control swarm behavior. Moreover, the base classes here can be used to rapidly prototype swarm variants. Check it out!
/r/Python
https://redd.it/7c0ju0
Hi! Few months ago I shared a very simple project in this sub, and thanks to your suggestions and comments, I learned a lot and was able to transform (or "overhaul") it into a full package. First off, thank you very much!
I would like to present [PySwarms](https://github.com/ljvmiranda921/pyswarms), a Python library for particle swarm optimization. Aside from performing basic optimization, you can inspect the behavior of your swarm and even look for the best hyper-parameters to control swarm behavior. Moreover, the base classes here can be used to rapidly prototype swarm variants. Check it out!
/r/Python
https://redd.it/7c0ju0
GitHub
GitHub - ljvmiranda921/pyswarms: A research toolkit for particle swarm optimization in Python
A research toolkit for particle swarm optimization in Python - GitHub - ljvmiranda921/pyswarms: A research toolkit for particle swarm optimization in Python
Trying to plot a Fourier transform.
I have to plot y = (4/np.pi) * sum((np.sin(n*x))/(n)) where I sum over x. I have shown attempt below, my problem is that is sums over x and n. I don't know how to fix this.
n = np.linspace(1, 11, 11)
x = np.arange(101)
y = (4/np.pi) * np.sum((np.sin(n*x))/(n))
plt.plot(x,y)
/r/Python
https://redd.it/7c1i52
I have to plot y = (4/np.pi) * sum((np.sin(n*x))/(n)) where I sum over x. I have shown attempt below, my problem is that is sums over x and n. I don't know how to fix this.
n = np.linspace(1, 11, 11)
x = np.arange(101)
y = (4/np.pi) * np.sum((np.sin(n*x))/(n))
plt.plot(x,y)
/r/Python
https://redd.it/7c1i52
reddit
Trying to plot a Fourier transform. • r/Python
I have to plot y = (4/np.pi) * sum((np.sin(n*x))/(n)) where I sum over x. I have shown attempt below, my problem is that is sums over x and n. I...
Python Entry job
HI,
im self learning Python for a bout 8 months now, and i think i am intermediate level, but i have a long and solid background as hardware technician, and help desk. i wanna ask 2 questions, first: considering my experience in hardware and IT in general and my age 41! which road i should choose in python? i mean what is most beneficial field that fits to my own work. second: for some one with my understanding of python, what kind a job i can get as an entry level programming? thanks guys
/r/Python
https://redd.it/7c2fie
HI,
im self learning Python for a bout 8 months now, and i think i am intermediate level, but i have a long and solid background as hardware technician, and help desk. i wanna ask 2 questions, first: considering my experience in hardware and IT in general and my age 41! which road i should choose in python? i mean what is most beneficial field that fits to my own work. second: for some one with my understanding of python, what kind a job i can get as an entry level programming? thanks guys
/r/Python
https://redd.it/7c2fie
reddit
Python Entry job • r/Python
HI, im self learning Python for a bout 8 months now, and i think i am intermediate level, but i have a long and solid background as hardware...
Nominations for the Malcolm Tredinnick Memorial Prize 2017
https://www.djangoproject.com/weblog/2017/nov/10/nominations-malcolm-prize-2017/
/r/django
https://redd.it/7c2fjy
https://www.djangoproject.com/weblog/2017/nov/10/nominations-malcolm-prize-2017/
/r/django
https://redd.it/7c2fjy
reddit
Nominations for the Malcolm Tredinnick Memorial Prize 2017 • r/django
4 points and 0 comments so far on reddit
Following my last post, I am writing the next post in my compilers series. This week is about writing the lexer in python!
http://yoseph.tech/completely-useless-fun-project-parts-of-the-compiler/
/r/Python
https://redd.it/7c44h3
http://yoseph.tech/completely-useless-fun-project-parts-of-the-compiler/
/r/Python
https://redd.it/7c44h3
yoseph.tech
Completely Useless Fun Project: Parts Of The Compiler - Yoseph.TECH | All things Tech
This week I am talking about the parts of the compiler, doing a deep dive into the Lexer and Parser and showing how to build the Lexer and Parser in Python. At the end of this post, we should have a working lexer and parser.
Emacs as a Django IDE. What's the best way to do this these days?
**tl;dr: There hasn't been a discussion about this on this sub in over a year and I'm curious what tools there are available to configure Emacs as an effective "cloud-based" (over SSH) IDE for Django.**
I've been going through various text editors and IDEs and while I've found some I like, I'd really like to centrally host it myself instead of having synced environments between multiple machines and operating systems. Enter cloud-based IDEs. I want to self-host it so that immediately rules out the bulk of the options out there. The self-hosted options I've found haven't been terribly impressive. Then I remembered since I never bothered to learn Emacs or Vim, I had no idea what people who insisted on using them as IDEs were on about. After some research, I decided to try Emacs first.
So my first trial is going to be Emacs hosted in an LXD container that I just SSH into for development. While I'm not comfortable navigating it without a cheatsheet yet I very much like the layout and working in the terminal. My question is how best to configure it for modern versions of Django and Python development?
I found [this page on the wiki](https://code.djangoproject.com/wiki/Emacs) but it appears to be a bit outdated so I'd like to know if there are any other options I should try (and possibly add to the wiki). The first tool, python-django.el hasn't been updated in over two years and the intro link is dead. Pony Mode looks actively maintained and I intend to try it. New django-mode claims to be the newest and best but there's zero documentation and it doesn't look very actively maintained.
Anything else I should be looking into?
/r/django
https://redd.it/7c2pza
**tl;dr: There hasn't been a discussion about this on this sub in over a year and I'm curious what tools there are available to configure Emacs as an effective "cloud-based" (over SSH) IDE for Django.**
I've been going through various text editors and IDEs and while I've found some I like, I'd really like to centrally host it myself instead of having synced environments between multiple machines and operating systems. Enter cloud-based IDEs. I want to self-host it so that immediately rules out the bulk of the options out there. The self-hosted options I've found haven't been terribly impressive. Then I remembered since I never bothered to learn Emacs or Vim, I had no idea what people who insisted on using them as IDEs were on about. After some research, I decided to try Emacs first.
So my first trial is going to be Emacs hosted in an LXD container that I just SSH into for development. While I'm not comfortable navigating it without a cheatsheet yet I very much like the layout and working in the terminal. My question is how best to configure it for modern versions of Django and Python development?
I found [this page on the wiki](https://code.djangoproject.com/wiki/Emacs) but it appears to be a bit outdated so I'd like to know if there are any other options I should try (and possibly add to the wiki). The first tool, python-django.el hasn't been updated in over two years and the intro link is dead. Pony Mode looks actively maintained and I intend to try it. New django-mode claims to be the newest and best but there's zero documentation and it doesn't look very actively maintained.
Anything else I should be looking into?
/r/django
https://redd.it/7c2pza
Large file upload to S3
https://www.codingforentrepreneurs.com/blog/large-file-uploads-with-amazon-s3-django/
/r/django
https://redd.it/7c51bp
https://www.codingforentrepreneurs.com/blog/large-file-uploads-with-amazon-s3-django/
/r/django
https://redd.it/7c51bp
Coding for Entrepreneurs
Large File Uploads with Amazon S3 + Django - Blog - Coding for Entrepreneurs
Handling large file uploads can be a challenge. In this one, we aim to make it …
[AF] Explanation of `pip install --editable .`
The current [Flask documentation shows](http://flask.pocoo.org/docs/0.12/tutorial/packaging/) that flask apps should be created as a package. That includes a `setup.py` and `MANIFEST.in`.
If I'm not distributing my app for someone else to use, why would I do this?
If I didn't want to go through this setup, how would I configure my app so I could follow the example? e.g.
export FLASK_APP=flaskr
export FLASK_DEBUG=true
flask run
/r/flask
https://redd.it/7bz93o
The current [Flask documentation shows](http://flask.pocoo.org/docs/0.12/tutorial/packaging/) that flask apps should be created as a package. That includes a `setup.py` and `MANIFEST.in`.
If I'm not distributing my app for someone else to use, why would I do this?
If I didn't want to go through this setup, how would I configure my app so I could follow the example? e.g.
export FLASK_APP=flaskr
export FLASK_DEBUG=true
flask run
/r/flask
https://redd.it/7bz93o
[N] Tile: A New Language for Machine Learning
http://vertex.ai/blog/tile-a-new-language-for-machine-learning#
/r/MachineLearning
https://redd.it/7c3vul
http://vertex.ai/blog/tile-a-new-language-for-machine-learning#
/r/MachineLearning
https://redd.it/7c3vul
reddit
[N] Tile: A New Language for Machine Learning • r/MachineLearning
63 points and 20 comments so far on reddit
How to work with Django in Windows 10?
Hi. In all my Django programming life I have been developing in Ubuntu Linux. I still use Ubuntu at home. It's awesome. Now I got a new job and I have to work on Windows (10). I have successfully installed WSL and bash terminal which I use for ssh connections and other things. So, now what? Should I keep using bash terminal in windows 10 for all my developing purposes? (Python, Django, vim, PostgreSQL, virtualenvrapper, etc) or should I go full-on-windows and install PyCharm (which is my main working IDE), Windows-PostgreSQL, windows-python, virtulanevwrapper-win, etc and use bash-terminal only for ssh?
/r/django
https://redd.it/7c6zk8
Hi. In all my Django programming life I have been developing in Ubuntu Linux. I still use Ubuntu at home. It's awesome. Now I got a new job and I have to work on Windows (10). I have successfully installed WSL and bash terminal which I use for ssh connections and other things. So, now what? Should I keep using bash terminal in windows 10 for all my developing purposes? (Python, Django, vim, PostgreSQL, virtualenvrapper, etc) or should I go full-on-windows and install PyCharm (which is my main working IDE), Windows-PostgreSQL, windows-python, virtulanevwrapper-win, etc and use bash-terminal only for ssh?
/r/django
https://redd.it/7c6zk8
reddit
How to work with Django in Windows 10? • r/django
Hi. In all my Django programming life I have been developing in Ubuntu Linux. I still use Ubuntu at home. It's awesome. Now I got a new job and I...
Tiket untuk peserta PyCon pertama di Indonesia telah tersedia. Grab it fast before you missed it, guys!
https://goo.gl/xDLgan
https://goo.gl/xDLgan
use python pandas to show csv to placeholder in web file
I have a csv file and need to convert it to view it in html. I know python pandas can do it with
df = pd.read_csv("myfile.csv")
df.to_html('output.html')'
but I don't want to show it in single web page, I have index.html file and I want to show it in there but in another section.
/r/Python
https://redd.it/7c6s75
I have a csv file and need to convert it to view it in html. I know python pandas can do it with
df = pd.read_csv("myfile.csv")
df.to_html('output.html')'
but I don't want to show it in single web page, I have index.html file and I want to show it in there but in another section.
/r/Python
https://redd.it/7c6s75
reddit
use python pandas to show csv to placeholder in web file • r/Python
I have a csv file and need to convert it to view it in html. I know python pandas can do it with df = pd.read_csv("myfile.csv") ...
Please help to improve the awesome-jupyter list on github!
You can *fork* and pull-request the [github](https://github.com/postpdm/awesome-jupyter) repo, or place the [issue](https://github.com/postpdm/awesome-jupyter/issues) to github repo, or post the interesting links here.
Thank you!
/r/IPython
https://redd.it/7c7ur6
You can *fork* and pull-request the [github](https://github.com/postpdm/awesome-jupyter) repo, or place the [issue](https://github.com/postpdm/awesome-jupyter/issues) to github repo, or post the interesting links here.
Thank you!
/r/IPython
https://redd.it/7c7ur6
GitHub
postpdm/awesome-jupyter
A curated list of awesome Jupyter and IPython links - postpdm/awesome-jupyter