Python Daily
2.57K subscribers
1.48K photos
53 videos
2 files
38.9K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
[D] Dress code at NIPS?

I am attending NIPS next week and this is my first time ever attending this conference (or any top-tier ML conference). I have been to a lot of medical, visualization, and lower tier ML conferences. I have a couple of questions:

1. At many of the medical and other conferences, you see most people in business casual (dress shirt with tie) or even with full suits. From what I understand, NIPS is nowhere near this case (which sounds awesome). What should I expect? Khakis with a casual button down? Or just jeans with a t-shirt? What about if speaking to companies at booths?

2. Piggy backing on the last part of the first question, I have seen that there will be a lot of companies at NIPS. As somebody finishing my PhD next year, what is the best course for exploratory talks with companies? And similar to the first question: are any of these conversations like a normal interview where proper dress code is expected?

I am excited to attend NIPS for the first time, and as is probably evident…I am trying to break away from the strict dress code expected at some other conferences.

(Reposted with Discussion tag.)

/r/MachineLearning
https://redd.it/7g7255
DB Schema Help

Hey everyone would like some insight on this DB schema:


-a standard user


-category(name:string, user: user.id)


-activity(name: string, description: text, category: category.name, user:user.id)


A `user` inputs `activities` they do and each `activity` can have a designated `category`. Is it okay for both models to have a `user` object? I'm trying it like this because I want to be able to do something like `User.categories.all()` to get all categories instead of doing something like
`categories = activity.category for activity in Activity.objects.filter(user=user)`

/r/django
https://redd.it/7gaws2
Any Django + React tutorial/resources?

Hey guys, I was wondering if there is a book or tutorial that covers django+react, specifically integration of react into django (and the best practice thereof). I did read a few posts in this subreddit pertaining to this topic but most of them seem to talk about basics of react rather than integration. Thank you in advance.

/r/django
https://redd.it/7g9yy1
Need to hire a Django developer. What questions should I ask him/her to test their abilities?

I'm currently looking to hire a Django developer for a cryptocurrency based site. As the site will be handling cryptocurrency security is a big factor in the way the site needs to be coded. I need someone who is an expert in Django and can get complicated stuff done quickly using the framework, and can also code with security in mind to create a website which is robust to hacking.


I have some interviews with Django developers over the next couple of days. What questions can I ask these people to test whether they are extremely competent at using Django?

/r/django
https://redd.it/7gdr6e
Flask timeout on Raspberry Pi?

Hey folks,

I have the below code running perpetually on my local network, hosted on my Pi. Its just a super simple app for using the Pi as a WOL server, but after a few days (maybe a week?) its inaccessible on my local network, and I have to restart the code on the Pi. Does flask auto shutdown after a certain amount of time or something? I've got a feeling the answer is no, but this has happened 2-3 times now so I thought I'd make a post to see if anyone has the same issue.

from flask import Flask

app = Flask(__name__)

@app.route('/')
def home():
'WOL Code here'
Return 'WOL activated'

if __name__ == '__main__':
app.run(host='0.0.0.0', port=3000)


/r/flask
https://redd.it/7gdfpm
Please rate and/or learn from my (form processing) code

I am a self-taught programmer and I just realized that, after sitting alone by myself all this time typing into my computer, I'm not entirely sure I have any idea what I'm doing as I have never had anyone ever see my code or offer any constructive criticism to how I've grown to do things.

I'd really appreciate if anyone could have a look at my code linked below and just let me know if anything crazy pops out at you. It's pretty close to how I usually do things as far as importing and instantiating classes and whatnot.

this code in particular is for processing a user sign-up form:
https://gist.github.com/anonymous/0ca1188bf5c3f7a33a2fff080107004b

/r/flask
https://redd.it/7gidq4
[AF] Post request working locally, but not remotely.

Hi all, I'm new to Flask (and web programming in general, so please excuse me if this is the wrong place) and am simply trying to use it to work as something my Raspberry Pi can use to receive input from the internet.

Anyway, here's the issue. I've set up a small page that has an html form (a text box and a submit button), so I think this should be generating a post request. Basically, the input from the form gets passed to some other python code (blinks an LED).

When I run the website to be accessible locally, I can enter the input, press the submit on the actual page and everything behaves as expected. Similarly, I can use curl and send the input as the body of a post request.

When I run the website to accessible remotely (I turn off debug and change the port to the one I've forwarded), I can navigate to the page (I have a domain name via no-ip) and enter the input in the box and press submit, and it works. However, when I try to submit the request via curl (i update the target to be the URL from noip rather than the local ip of the pi), it just hangs until it times out, and I see nothing happening on the computer that sent the request, or the pi running the flask server. When I try to submit the request via IFTTT, I do see that the server has a received a request, but I get a 400 error.

Im guessing this is a bug with NoIP, rather than flask, but I'm unsure of how to even go about debugging. Flask gurus, do you have any ideas here?

/r/flask
https://redd.it/7geqag
Double underscore method for ordering the list returned by the view based on a field in another model not working

I'm trying to order the list the view returns based on a field in another model. I read the [documentation over here](https://docs.djangoproject.com/en/1.11/ref/models/querysets/#order-by) and it says I could do that by using the model's name, if the ordering is specified in the model's meta.

**View**

class ResultsView(generic.DetailView):
model = Question
template_name = 'polls/results.html'
ordering = ['choice']


**Model**

class Choice(models.Model):
question = models.ForeignKey(Question, on_delete=models.CASCADE)
choice_text = models.CharField(max_length=200)
votes = models.IntegerField(default=0)

def __str__(self):
return self.choice_text

class Meta:
ordering = ['-votes']

I did that, it works but I have different views which require the same model to be ordered in different ways, say one by it's name and another by votes. How can I achieve something like that?

For example I am looking for something like

**View 1**

class ResultsView(generic.DetailView):
model = Question
template_name = 'polls/results.html'
ordering = ['-choice__votes']

**View 2**

class DetailView(generic.DetailView):
model = Question
template_name = 'polls/detail.html'
ordering = ['-choice__choice_text']

/r/djangolearning
https://redd.it/7gj6xz
Share your Apps/Websites created using Django? We need motivation!

Please provide with information such as:

Website Link:

Active Users:

Monthly Revenue Generation:

Website details, and target Costumer:

Important things Learned while creating your website:

Packages/Libraries used:


Thank you for sharing.

/r/django
https://redd.it/7gldnw
What is the first interesting program you made with python?

I created the bounce game (Python for kids) today. It's the game we played in our childhood where the ball used to move randomly and we had to save it from hitting the bottom. Not that big of a deal for some, but good enough for me. Have been working with Django for an year now, but this is way more fun than building scalable websites or analyzing data. What is your first exciting moment with python?

/r/Python
https://redd.it/7gm1ze
When I create a new Flask project, here are 15 libraries that are always in my requirements.txt file. What libraries do you use?

I find myself using these libraries in every new Flask project I set up:

* gunicorn
* flask-debugtoolbar
* pytest and pytest-cov
* flake8
* Flask-SQLAlchemy and psycopg2
* alembic
* celery and redis
* Flask-WTF and WTForms-Components
* Flask-Login
* Flask-Limiter
* Flask-Mail

If you want to know why I use all of these libraries, more details can be found at
https://nickjanetakis.com/blog/15-useful-flask-extensions-and-libraries-that-i-use-in-every-project.

What's your favorite extensions and libraries?

/r/flask
https://redd.it/7g4wzg
When I create a new Flask project, here are 15 libraries that are always in my requirements.txt file. What libraries do you use?

I find myself using these libraries in every new Flask project I set up:

* gunicorn
* flask-debugtoolbar
* pytest and pytest-cov
* flake8
* Flask-SQLAlchemy and psycopg2
* alembic
* celery and redis
* Flask-WTF and WTForms-Components
* Flask-Login
* Flask-Limiter
* Flask-Mail

If you want to know why I use all of these libraries, more details can be found at
https://nickjanetakis.com/blog/15-useful-flask-extensions-and-libraries-that-i-use-in-every-project.

What's your favorite extensions and libraries?

/r/flask
https://redd.it/7g4wzg