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
Database design

Hi guys, so I was wondering if there were any online tool, or your favourite method how to design DB tables/Django Models and relations between them. I seem to have a really hard time when trying to visualize in my head what I need to do to. I am kinda unable to see how to models are going to work together until I test it in the admin interface, only then it makes sense, but it's just highly ineffective and I had to completely wipe out the whole DB and re-do it again many times because I broke something when creating migrations. I never really know, what to set as defaults. I can make a functional DB, but I want to do it well, normalized.

​

Maybe even some typical examples would help. Like I know that a foreign key is a column that branches out to rows in another column, but when the table it points to consists of another foreign key, my head is about to explode xD

​

For example I am building an eshop but without prices, carts, payments etc. just like a gallery and the rest is discussed with a customer. Now this is what I have so

/r/django
https://redd.it/bb9yos
MLConjug. A Python library to conjugate verbs in French, English, Spanish, Italian, Portuguese and Romanian (more soon) using Machine Learning techniques.

Hi all,

​

I am the author of the open source project [mlconjug](https://pypi.org/project/mlconjug/), a Python library to conjugate verbs in French, English, Spanish, Italian, Portuguese and Romanian (more soon) using Machine Learning techniques.

​

Any verb in one of the supported language can be conjugated, as the module contains a Machine Learning model of how the verbs behave. Even completely new or made-up verbs can be successfully conjugated in this manner. The supplied pre-trained models are composed of:

* a custom-made binary feature extractor,
* a feature selector using Linear Support Vector Classification,
* a classifier using Stochastic Gradient Descent.

MLConjug uses scikit-learn to implement the Machine Learning algorithms.Users of the library can use any compatible classifiers from scikit-learn to modify and retrain the models.

* Free software: MIT license
* Documentation: [https://mlconjug.readthedocs.io](https://mlconjug.readthedocs.io/).

### Supported Languages

* French
* English
* Spanish
* Italian
* Portuguese
* Romanian

### Features

* Easy to use API.
* Includes pre-trained models with 99% + accuracy in predicting conjugation class of unknown verbs.
* Easily train new models or add new languages.
* Easily integrate MLConjug in your own projects.
* Can be used as a command line tool.

​

Do not hesitate to try it out and let me know if you find bugs, want to propose improvements or want some specific languages added.

​

Cheers,

​

SekouD

/r/Python
https://redd.it/bb8400
Has anyone built a project based on Guardian?

Long story short, I'm working on a project in which I need to be able to assign users to a group and groups to an event. I have read through the guardian documentation and I believe this does exactly that, providing the ability to create unique events with groups over users that can modify them.

This is the first project of this kind that I've worked on, so I'm interested to see if anyone can chime in. Specifically:

1. Did you create an intermediate model to link the group to the event?
2. Should this live in three separate apps: User, Group, Event?

Thanks in advance.

/r/django
https://redd.it/bbbhcm
Django with Graphene

Hey guys,

​

I'm creating my first django graphql api with graphene and wondering how can this be written in a shorter way:

​

[https://pastebin.com/T4nsEZMj](https://pastebin.com/T4nsEZMj) \- [models.py](https://models.py)

[https://pastebin.com/71Q6KC4q](https://pastebin.com/71Q6KC4q) \- schema.py

​

[https://pastebin.com/3Lu7268q](https://pastebin.com/3Lu7268q) \- graphql\_query

[https://pastebin.com/3VQSb3Wy](https://pastebin.com/3VQSb3Wy) \- graphql\_results

/r/django
https://redd.it/bbceyd
Congratulations Python community we are still dominanting !

Heads-up to the community for creating such a lovable and supporting ecosystem. Python is the forth most popular language, second most loved language and the most wanted and fastest growing language in the latest stack overflow survey.

https://insights.stackoverflow.com/survey/2019

/r/Python
https://redd.it/bbgi5w
Sharing a text-based game I made in about a week

Hello everyone,

I don't know if this is the place to share but I didn't know where else would I post this so here it is.

I wrote pretty much all of the core code in about a week and then I spent the next few days polishing some stuff and adding some more features. I embarked on this project as an excuse to get to finally start learning Python since I've been wanting to do so for some time now.

After about 3 weeks now, I feel that I've come a long way (after struggling with many things, which is good!). Nonetheless, I'm still beginning the journey, and there's a lot more to learn.

Anyways, without further ado, here's the link:

[Github Repository](https://github.com/anzorein/tavern-game)

You can either download the installer, or just download the files and run the main file.

It has a description in there but I'll explain a little bit here.
* * *
## Description

In this game you are an innkeeper and you have to manage your tavern.

Your main resources are money and renown, which you can use to improve your tavern so more peope can come to drink or stay the night. Also you can hire adventurers and send them on quests.
* * *
Anyways,

/r/Python
https://redd.it/bbgjnt
Heroku - Serving static files through Flask

I have a Flask app that's deployed on Heroku and have just been reading how inefficient it is to serve static files through Flask. And from what I have gathered, nginx + gunicorn are the stack that is used to solve this. Please correct me if I am wrong.

My questions are:

1. If my app is deployed on Heroku, how can I serve static files elsewhere and not through Flask? Is it possible to use Nginx in Heroku to do that?
2. I also read a lot of "how" to serve static files on Nginx, but not "why", why is it inefficient to use Flask for this task? Say I have less than 50 users, is this still inefficient? When should I consider not serving it through Flask?

/r/flask
https://redd.it/bbknws
Flask-Admin and Flask-Login with Flask-JWT or Flask-Praetorian?

Perhaps it's a dumb question. I'm a newbie for this things.

​

It's possible to use Flask-Admin and Flask-Login combined with these extensions?

​

I want to have some the features of Flask-Admin and Flask-Login for register the users using the browser and make requests from a desktop app to do some calculations using JWT.

/r/flask
https://redd.it/bbd3w6
Django Hyper Editor - Django Integration of Hyper Editor

Couple of days back I have released a Block Based Content Editor. Now its Django integration is ready to play with. Really love to hear what you guys think. Any suggestions or thought would be very helpful.

[https://github.com/DivineITLimited/django-hyper-editor](https://github.com/DivineITLimited/django-hyper-editor)

/r/django
https://redd.it/bbop9q
[N] Google launches an end-to-end AI platform

https://cloud.google.com/ai-platform/

And a TC article, which did a decent job explaining what this is about.

https://techcrunch.com/2019/04/10/google-expands-its-ai-services/

Google launches an end-to-end AI platform. It promises the ability to handle the whole lifecycle of an ML project, from prototyping to production serving. There's also a new labeling service.

What do you guys think?

/r/MachineLearning
https://redd.it/bbpuh8
Has anyone else had issues with the default tutorial



I am following this[ tutorial](https://docs.djangoproject.com/en/2.2/intro/tutorial01/)

and I am getting 404 errors when I try the first test saying it cannot find "polls/" below is some of my code in mysite/urls.py

from django.contrib import admin
from django.urls import include, path

urlpatterns = [
path('polls/', include('polls.urls')),
path('admin/', admin.site.urls),
]

in polls/urls.py

from django.urls import path

from . import views

urlpatterns = [
path('', views.index, name='index'),
]

I am not sure what is going on because I am following the tutorial step by step and I am getting a 404 error

/r/djangolearning
https://redd.it/bbu73m