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
You can accidentally override local variables with PEP 572 -- Assignment Expressions

/r/Python
https://redd.it/8fokpw
[D] Why is Z-dimension for GANs usually 100?

I'm playing around with GANs, I've got a question which I can't find answer for. Why is Z-dimension (random vector noise) for GANs usually 100? I saw a lot of GitHub projects and online tutorials, seems like the random vector has always the size of 100. Is it confirmed that it gives the best results? What if I changed that to e.g 1000? How does it affect the generated images?

/r/MachineLearning
https://redd.it/8fqcfv
Data Scientist interview in Python: what essential knowledge should I have?

If you search "Python Interview Questions" on this subreddit, nearly every one has a top comment along the lines of "these are rubbish". So, tell me, for a Data Scientist job requiring 5 years of Python, what should you know? Are there any resources that are *actually* any good?

/r/Python
https://redd.it/8fqyj6
Which Front End with Flask?

Hi, currently working on a project with flask sqlalchemy, and need to do something on Front End but can't figure out which one I should use? Thanks for help!

/r/flask
https://redd.it/8ft6e9
Migrating database(MySQL to PostreSQL): Attach migrated database to application

Good day,

I would just like to get some idea/s on how to do this task properly. I am a newbie in programming and got a job as Django Dev. My current task is to migrate a MySQL to PostgreSQL. Reading resources online, I found out this tool which helps me do a test migration in my local environment [https://github.com/dimitri/pgloader](https://github.com/dimitri/pgloader) .

MySQL database has 70 rows. I can confirm that when I access postgresql in cli, I can see all the tables as well as the data. Now my problem is, this is my first time to perform this kind of task. I have no idea how will I attach the database to our applications. The rows and fields from mysql database are not matched fully identical to our fields in [models.py](https://models.py) . Perhaps typing manually to admin is an option but its tedious especially if we will encounter this task again. I am planning to automate it.

Can someone share some light here to a newbie? Sorry for the long post, I just don't know how to approach this.

Thanks,

J

/r/django
https://redd.it/8frs6y
How to implement invisble recaptcha in django

Hello

I was researching on available apps for django that can implement Google's invisible recaptcha in django forms. Is there any module available or how do I implement it in my project?

Thanks

Edit:
Is there an alternative way I can handle spam in django? Which is the preferred method

/r/django
https://redd.it/8fshdt
[P] Job board exclusively for Remote Jobs in Machine Learning, Deep Learning and Data Science
https://remoteml.com/

/r/MachineLearning
https://redd.it/8ftpmo
Obtaining value in views.py from template

I've got the following code within my html template:

Template

<div class="submitbutton"> <a href="{% url 'accounts:customerhomepage' %}" target="_blank" value="1"> <button> View Demo </button> </a> </div>

I'd like to pass the value of 1 to the function in views.py that will render the page. Within the view, I've got the following code.

Views.py

demo = request.GET.get('value')
print(demo)

The printed result is 'None' rather than '1'. I'm not sure where my code is wrong.

Thanks!

/r/django
https://redd.it/8fwhpt
Dear r/Python, I made a thing! Details in comments :)

/r/Python
https://redd.it/8fy0g3
xkcd: Python Environment

/r/Python
https://redd.it/8fztrr
Separate Project, same database

I have a django project which needs some infinatly looping background tasks. Because I want to decouple this from my webserver (for scalability among others) I want to create a separate project that handles these backgrounds threads, where the projects will communicate over an message broker like RQ. here's the catch, both projects need access to the same database. Now I have two options. Either share the database(my prefered option).
Or keep 2 separate databases in sync(potential horror).
for the first option I would love it if I could import the models I defined in my django models, so I don't have to worry about keeping my database models in sync over two projects, and not have to worry about writing one database in sqlalchemy and the other in the normal django orm.
Any suggestions?



/r/django
https://redd.it/8fzesc
Export FLASK_APP only works sometimes

Hi all,

I am running into an issue where export FLASK_APP will sometimes work and other times doesn't.

Initial Steps:

1. Git clone https://github.com/level09/enferno and cd enferno
2. create virtual env
3. Brew Install mongodb and start it
4. install requirements.txt
5. npm install

Now if I do this:

1. export FLASK_APP=enferno.py
2. flask run
3. printenv FLASK_APP (this prints enferno.py)

I get error: ModuleNotFoundError: No module named 'enferno'

If I do this instead:

1. export FLASK_APP=run.py
2. flask run
3. printenv FLASK_APP (this prints run.py)

I get error: ModuleNotFoundError: No module named 'enferno.app' (which is logical, it cannot "see" enferno yet)

But if I repeat Initial Steps again in a different directory, running export FLASK_APP=run.py works!
I get the following:

(venv_enf2) 192-168-1-3:enferno user$ flask run
* Serving Flask app "run"
* Forcing debug mode off
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)

I did not do anything different between the two directories, but both has different outcomes. Is there a flask dump I can get and read what's wrong with it?

In both directories I used the same virtual environment.



/r/flask
https://redd.it/8fzo2i
JavaScript integration with flask

Hey there,
I currently want to integrate my frontend with my python code and decided to use flask for the it. I tried jsonify() to create a jason object and send it to JavaScript but it doesn’t seem to work. Any ideas of what could go wrong or any material which would help in this integration.
Thank you.


/r/flask
https://redd.it/8fu9h9
How and why does JupyterLab depend on Node.js?

I installed the Matplotlib Jupyter widget, and found out it had Node.js as a prerequisite. [Link to instructions](https://github.com/matplotlib/jupyter-matplotlib)

Why? How does JupyterLab use Node?

Thank you.

/r/IPython
https://redd.it/8g2tic