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
Simple notification system on Django web client?

I have a apiview which takes some info from a request object, starts a new thread to run a script (which can take a while to run) and then returns a 202 Response. Is there a library that I can leverage to send a popup notification to the client when the script has finished running?

/r/django
https://redd.it/7os5f7
mnt local notebook directories to a jupyter docker container

I have a docker container for jupyter notebooks https://github.com/zos-spark/interactive-insights-workbench/blob/master/notebook/Dockerfile

I want to mount a local dir with all notebooks into the dockerfile. How can I achieve it?

/r/IPython
https://redd.it/7otntr
I've been creating a Python web framework for the past several months and it's really awesome.

I'd like to share a new python web framework I've been working on called Masonite. Those of you who have used Laravel before, it is very similiar in architecture to Laravel.

I've had a lot of fun writing and developing in it and learned A LOT. Those of you that are interested in creating a new Python web framework, PR's are wecome. Installation is nice and easy. (YMMV)

[GitHub Repo](https://github.com/josephmancuso/masonite)

[Documentation](http://masonite.docsforcode.com)

I was very pleased with Django but after using a framework like Laravel, I've noticed so many flaws with Django and want to create a framework that is much more simple, developer friendly and easier to use than Django.

Feedback and contributions are appreciated!



/r/Python
https://redd.it/7ou24s
Should I move from 1.11 to 2 before deploying on a server ?

I have almost finished a Django project I have been developing. I have started on 1.11 but now I see that there is Django 2.

I am wondering if I should move to Django 2 before putting my project on a server.

/r/django
https://redd.it/7ou5sm
Making a currency/point system for a site?

Hey my friends and I are often betting on stuff (like who will win a football game or who will get drunk first) so I thought I would make something like a 'betting' app for us to bet like 2 points/coin on something. Does anyone know how to make currency or point systems and or a betting system?

/r/django
https://redd.it/7ojing
Why is git push heroku master not working in this situation?

Im tryin to push django project i have on git.
I created runtime.txt file in root direcotry with the text 'python-3.4.0'
I also created Pocfile with the text 'web: gunicorn mb_project.wsgi --log-file -'
I have no idea why is this not working, checked a lot of threads on quora and stackoverflow... MAybe heroku doesnt like python 3.4.0 ? But i changed it to 3.6.3 and i still got the same error

/r/django
https://redd.it/7okffi
Seeking advice on putting together the model structure for a 1-to-1 chat using Channels.

I'm struggling with implementing the data structure for a chat system. I've looked through most of the popular tutorials but I'm still having trouble applying it to my own use-case.

I am looking to allow a chat system similar in structure(not UI) to facebook or AIM from back in the day--one on one messaging, with message persistence, and a user able to have many chats.

The tutorials I've looked through have conflicting suggestions.
Given that I already have a model called `Pair` which has two `ForeignKeys`, named `requester` and `accepter`, each pointing to a `User`, how might I structure the messages or rooms around this `Pair`? (structuring around `Pair` isn't mandatory, I just thought it may be convenient)

What I've brainstormed:
1) Have a single `Room` model with a FK to the `Pair` model, and two TextFields for the messages: `to_accepter` & `from_accepter` to denote the messages belonging to the appropriate user.

2) Have a `Room` model and a separate `Message` model. The message will have an FK to the room, and have fields: `sent_from`(message sender), a timestamp(to eventually organize the list of displayed messages, and the TextField.

Is there an ideal way to go about this? I'm open to any suggestion.
Thanks in advance.

/r/django
https://redd.it/7ob65e
[off?] My wife made me a python banner

/r/Python
https://redd.it/7oz812
Redefining or updating a migrated model

I find myself modifying and changing features on some of my models often and sometimes get this message because I changed a foreign key:

You are trying to add a non-nullable field 'client' to env_contact without a default;
we can't do that (the database needs something to populate existing rows).

Please select a fix:

1) Provide a one-off default now (will be set on all existing rows with a null value for this column)

2) Quit, and let me add a default in models.py

Usually I have mock data or no data in these tables. Is there a way to delete the tables and migrations and redefine the model from scratch without doing a data dump, nuking the db and then resetting the models?

/r/djangolearning
https://redd.it/7p0yas
[Blog series] Django, GraphQL & React

Hello,
I wrote a blog series where I connect django app to react & relay using GraphQL. All comments welcome!
Links: https://krzysztofzuraw.com/blog/2017/django-graphql-react-part-one.html (at the bottom of the post you can find link to next blog post in the series).

/r/django
https://redd.it/7p1v76
Where do I find projects to contribute to as a beginner?

I am new to Python and would like to work with others, but I don't know where I can find projects that match my skill level.

/r/Python
https://redd.it/7p1ltq
Having trouble with static files in a docker-django build on the Docker Toolkit

Posting this in both Django and Docker subs. I have tried a lot of combinations of setting static_url/dirs/and roots but so far no luck. File structure is wonky but I think it's right:

-US
--Static
---USApp
----/style.css
--USPro
---settings.py

end of my settings file currently looks like this:
STATIC_URL = '/Static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "Static/USApp"),
]
STATIC_ROOT = "/US/Static/USApp/"

any help would be greatly appreciated!

/r/django
https://redd.it/7p49sj