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
Advice for starting a Flask application
I'm going to create a flask-rest api for my iOS app. When I'm developing the API should I deploy on heroku and every time I make a change commit the code and test it, or should I run everything locally then deploy when I'm finished with the API? I just feel I should test it on production servers then just on my computer locally.
/r/flask
https://redd.it/7bxuvg
I'm going to create a flask-rest api for my iOS app. When I'm developing the API should I deploy on heroku and every time I make a change commit the code and test it, or should I run everything locally then deploy when I'm finished with the API? I just feel I should test it on production servers then just on my computer locally.
/r/flask
https://redd.it/7bxuvg
reddit
Advice for starting a Flask application • r/flask
I'm going to create a flask-rest api for my iOS app. When I'm developing the API should I deploy on heroku and every time I make a change commit...
Apache with wSGI Configuration
I have installed Apache2.4.18 on my Ubuntu machine. I can access the 'Apache2 Ubuntu Default Page' from outside my home network, so Apache seems to be working.
I have a working Django website that I can access at my localhost (127.0.0.1:8000).
I need to configure Apache to serve my Django website instead of its Default page.
[Django's guide](https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/modwsgi/) says to edit Apache's 'httpd.conf' file, but no such file exists on my machine.
[This guide](https://www.thecodeship.com/deployment/deploy-django-apache-virtualenv-and-mod_wsgi/) walks me through the creation of a file that looks similar to what the Django guide is talking about, but there seems to be some major differences between the two.
I don't know where the 'httpd.conf' file should be located. I'm not sure whether the filename needs to be 'httpd.conf' or not. I don't know what information should be contained within 'httpd.conf'.
Thanks for any help in advance!
/r/djangolearning
https://redd.it/7c9ams
I have installed Apache2.4.18 on my Ubuntu machine. I can access the 'Apache2 Ubuntu Default Page' from outside my home network, so Apache seems to be working.
I have a working Django website that I can access at my localhost (127.0.0.1:8000).
I need to configure Apache to serve my Django website instead of its Default page.
[Django's guide](https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/modwsgi/) says to edit Apache's 'httpd.conf' file, but no such file exists on my machine.
[This guide](https://www.thecodeship.com/deployment/deploy-django-apache-virtualenv-and-mod_wsgi/) walks me through the creation of a file that looks similar to what the Django guide is talking about, but there seems to be some major differences between the two.
I don't know where the 'httpd.conf' file should be located. I'm not sure whether the filename needs to be 'httpd.conf' or not. I don't know what information should be contained within 'httpd.conf'.
Thanks for any help in advance!
/r/djangolearning
https://redd.it/7c9ams
Django Project
The web framework for perfectionists with deadlines.
To use Turbolinks 5 with Django, how can I automate inclusion of the Turbolinks-Location header when using redirect()?
According to the Turbolinks 5 documentation for "Following Redirects" (https://github.com/turbolinks/turbolinks#following-redirects):
> When you visit location `/one` and the server redirects you to location
> `/two`, you expect the browser’s address bar to display the redirected
> URL.
>
> However, Turbolinks makes requests using `XMLHttpRequest`, which
> transparently follows redirects. There’s no way for Turbolinks to tell
> whether a request resulted in a redirect without additional
> cooperation from the server.
And the solution for this is to:
> send the `Turbolinks-Location` header in response to a visit that was
> redirected, and Turbolinks will replace the browser’s topmost history
> entry with the value you provide.
>The Turbolinks Rails engine performs this optimization automatically for non-GET XHR requests that redirect with the `redirect_to` helper.
I have a great interest in using Turbolinks on my Django (1.11) project and I'm wondering if anyone could point me in the right direction of how to create a new Django redirect() function or modify the existing one to always include the Turbolinks-Location header that is needed for redirects to function as expected. I definitely do not want to be manually setting this header every time I do a redirect.
There is a similar entry in the 'Redirecting After a Form Submission' section (https://github.com/turbolinks/turbolinks#redirecting-after-a-form-submission) I would also appreciate any help in understanding how to implement:
> If form submission results in a state change on the server that
> affects cached pages, consider clearing Turbolinks’ cache with
> `Turbolinks.clearCache()`.
>
> The Turbolinks Rails engine performs this optimization automatically
> for non-GET XHR requests that redirect with the `redirect_to` helper.
I did see there is a "Drop-in turbolinks implementation for Django" package on github but this is forked from turbolinks-classic and sourcecode has no mentions of the Turbolinks-Location header so I am sure this is not what I'm looking for.
/r/django
https://redd.it/7c9wh4
According to the Turbolinks 5 documentation for "Following Redirects" (https://github.com/turbolinks/turbolinks#following-redirects):
> When you visit location `/one` and the server redirects you to location
> `/two`, you expect the browser’s address bar to display the redirected
> URL.
>
> However, Turbolinks makes requests using `XMLHttpRequest`, which
> transparently follows redirects. There’s no way for Turbolinks to tell
> whether a request resulted in a redirect without additional
> cooperation from the server.
And the solution for this is to:
> send the `Turbolinks-Location` header in response to a visit that was
> redirected, and Turbolinks will replace the browser’s topmost history
> entry with the value you provide.
>The Turbolinks Rails engine performs this optimization automatically for non-GET XHR requests that redirect with the `redirect_to` helper.
I have a great interest in using Turbolinks on my Django (1.11) project and I'm wondering if anyone could point me in the right direction of how to create a new Django redirect() function or modify the existing one to always include the Turbolinks-Location header that is needed for redirects to function as expected. I definitely do not want to be manually setting this header every time I do a redirect.
There is a similar entry in the 'Redirecting After a Form Submission' section (https://github.com/turbolinks/turbolinks#redirecting-after-a-form-submission) I would also appreciate any help in understanding how to implement:
> If form submission results in a state change on the server that
> affects cached pages, consider clearing Turbolinks’ cache with
> `Turbolinks.clearCache()`.
>
> The Turbolinks Rails engine performs this optimization automatically
> for non-GET XHR requests that redirect with the `redirect_to` helper.
I did see there is a "Drop-in turbolinks implementation for Django" package on github but this is forked from turbolinks-classic and sourcecode has no mentions of the Turbolinks-Location header so I am sure this is not what I'm looking for.
/r/django
https://redd.it/7c9wh4
GitHub
GitHub - turbolinks/turbolinks: Turbolinks makes navigating your web application faster
Turbolinks makes navigating your web application faster - turbolinks/turbolinks
DataViz Mastery Part 2 - Word Clouds
https://mubaris.com/2017-11-11/dataviz-mastery-part2
/r/pystats
https://redd.it/7c8qzs
https://mubaris.com/2017-11-11/dataviz-mastery-part2
/r/pystats
https://redd.it/7c8qzs
Mubaris NK
DataViz Mastery Part 2 - Word Clouds by Mubaris NK
This is part 2 of DataViz Mastery. In part 1, we learned how to create Treemaps using Python - Read it here. In this post we will learn how...
A drop-in Erlang node implementation in Python, designed to allow access to existing Python projects from Erlang and the opposite. With just a few lines of startup code your Python program becomes a fully functional Erlang node.
https://github.com/esl/Pyrlang
/r/Python
https://redd.it/7cb2to
https://github.com/esl/Pyrlang
/r/Python
https://redd.it/7cb2to
GitHub
Pyrlang/Pyrlang
Erlang node implemented in Python 3.5+ (Asyncio-based) - Pyrlang/Pyrlang