Problem with saleor. Category page not loading after running npm start and yarn run build-assets
After running yarn run build-assets so that I can change the css, I can't see any of the categories' loading the items in the page. Before running it I could see the category items.
I am using ngx_pagespeed. Could that be the cause the problems I am having? The js in all the other pages is working properly except for categories.
/r/django
https://redd.it/68zpya
After running yarn run build-assets so that I can change the css, I can't see any of the categories' loading the items in the page. Before running it I could see the category items.
I am using ngx_pagespeed. Could that be the cause the problems I am having? The js in all the other pages is working properly except for categories.
/r/django
https://redd.it/68zpya
reddit
Problem with saleor. Category page not loading after... • r/django
After running yarn run build-assets so that I can change the css, I can't see any of the categories' loading the items in the page. Before running...
socketserver: the networking module you didn't know you needed
http://silverwingedseraph.net/programming/2016/12/23/socketserver-the-python-networking-module-you-didnt-know-you-needed.html
/r/Python
https://redd.it/690zoz
http://silverwingedseraph.net/programming/2016/12/23/socketserver-the-python-networking-module-you-didnt-know-you-needed.html
/r/Python
https://redd.it/690zoz
Silver Winged Statements
socketserver: the Python networking module you didn't know you needed
Leo Tindall's blog about code and computers.
REST APIs with Flask and Python
https://medium.com/@RobSm/rest-apis-with-flask-and-python-db8b4f6cc433
/r/flask
https://redd.it/6905v7
https://medium.com/@RobSm/rest-apis-with-flask-and-python-db8b4f6cc433
/r/flask
https://redd.it/6905v7
Medium
REST APIs with Flask and Python
Are you tired of boring, outdated, incomplete, or incorrect tutorials? I say no more to copy-pasting code that you don’t understand.
Grouping in Django queries
I have a query set object with has two attributes: words, number_of_letters. I would like to group the words by the no of letters in them. For example, all the words with 4 letters should be grouped together. How do I do this when I don't know the maximum number of letters the grouping has? Will I be able to put the grouping into separate objects?
Also, is there a way to modify all the words in the object in one go? For example, if I need to prefix a string to all the words in the object?
/r/django
https://redd.it/691w5b
I have a query set object with has two attributes: words, number_of_letters. I would like to group the words by the no of letters in them. For example, all the words with 4 letters should be grouped together. How do I do this when I don't know the maximum number of letters the grouping has? Will I be able to put the grouping into separate objects?
Also, is there a way to modify all the words in the object in one go? For example, if I need to prefix a string to all the words in the object?
/r/django
https://redd.it/691w5b
reddit
Grouping in Django queries • r/django
I have a query set object with has two attributes: words, number_of_letters. I would like to group the words by the no of letters in them. For...
Django-Haystack, using custom views and forms for filtering
I've got a search view at the moment but would like to create a form to add check box filtering to the search results.
from haystack.generic_views import SearchView
from haystack.query import SearchQuerySet
from haystack.forms import SearchForm
class NoteSearchView(SearchView):
template_name = 'search.html'
form_class = SearchForm
def get_queryset(self):
queryset = SearchQuerySet()
return queryset
I want to create a category filter of 'Sports', 'Fiction', & 'Non-Fiction'. Any thoughts on how to achieve this? I thought maybe I could use the ModelSearchForm but override the default values in some way.
Thank you.
/r/djangolearning
https://redd.it/67vuuk
I've got a search view at the moment but would like to create a form to add check box filtering to the search results.
from haystack.generic_views import SearchView
from haystack.query import SearchQuerySet
from haystack.forms import SearchForm
class NoteSearchView(SearchView):
template_name = 'search.html'
form_class = SearchForm
def get_queryset(self):
queryset = SearchQuerySet()
return queryset
I want to create a category filter of 'Sports', 'Fiction', & 'Non-Fiction'. Any thoughts on how to achieve this? I thought maybe I could use the ModelSearchForm but override the default values in some way.
Thank you.
/r/djangolearning
https://redd.it/67vuuk
reddit
Django-Haystack, using custom views and forms... • r/djangolearning
I've got a search view at the moment but would like to create a form to add check box filtering to the search results. from...
Computer Freeze running recommender model create
I'm using GraphLab Create with a Jupyter Notebook. This is my first foray into Machine Learning. I have an NVIDIA GTX 770 and 8GB RAM.
My PC was fine up until I called GraphLab Create's [item_similarity_recommender](https://turi.com/products/create/docs/generated/graphlab.recommender.item_similarity_recommender.ItemSimilarityRecommender.html) on ~80M rows of data. Not only did the Notebook freeze but my entire computer did. As soon as I ran the command, it was locking up every half second. I have run the command on smaller (10,000) datasets before with no problem.
How do I solve this issue? Use a Cloud platform?
/r/IPython
https://redd.it/691bn6
I'm using GraphLab Create with a Jupyter Notebook. This is my first foray into Machine Learning. I have an NVIDIA GTX 770 and 8GB RAM.
My PC was fine up until I called GraphLab Create's [item_similarity_recommender](https://turi.com/products/create/docs/generated/graphlab.recommender.item_similarity_recommender.ItemSimilarityRecommender.html) on ~80M rows of data. Not only did the Notebook freeze but my entire computer did. As soon as I ran the command, it was locking up every half second. I have run the command on smaller (10,000) datasets before with no problem.
How do I solve this issue? Use a Cloud platform?
/r/IPython
https://redd.it/691bn6
[Ask Flask] Moving database from sqlite to postgres causes a 400 Bad Request error
My code is working fine if I use a sqlite database but raises a 400 Bad Request error when I use a postgres database. This error is raised when I query the database. I tried deleting the request arguments from the query and that solves the problem however I want to keep the request arguments. Can you explain what causes flask to raise a 400 error when I use postgres and request arguments and tell me what I can do to solve the problem?
Code with request arguments:
@app.route("/data", methods=["GET"])
def data():
conn = e.connect()
nelat = request.args["neLat"]
nelng = request.args["neLng"]
swlat = request.args["swLat"]
swlng = request.args["swLng"]
query = conn.execute("SELECT * FROM coordinates WHERE lat < ? AND lat > ? AND lng < ? AND lng > ?", [float(nelat), float(nelng), float(swlat), float(swlng)])
result = {'data': [dict(zip(tuple (query.keys()) ,i)) for i in query.cursor]}
jsonData = json.dumps(result)
return jsonData
Code without request arguments:
@app.route("/data", methods=["GET"])
def data():
conn = e.connect()
query = conn.execute("SELECT * FROM coordinates")
result = {'data': [dict(zip(tuple (query.keys()) ,i)) for i in query.cursor]}
jsonData = json.dumps(result)
return jsonData
/r/flask
https://redd.it/694vki
My code is working fine if I use a sqlite database but raises a 400 Bad Request error when I use a postgres database. This error is raised when I query the database. I tried deleting the request arguments from the query and that solves the problem however I want to keep the request arguments. Can you explain what causes flask to raise a 400 error when I use postgres and request arguments and tell me what I can do to solve the problem?
Code with request arguments:
@app.route("/data", methods=["GET"])
def data():
conn = e.connect()
nelat = request.args["neLat"]
nelng = request.args["neLng"]
swlat = request.args["swLat"]
swlng = request.args["swLng"]
query = conn.execute("SELECT * FROM coordinates WHERE lat < ? AND lat > ? AND lng < ? AND lng > ?", [float(nelat), float(nelng), float(swlat), float(swlng)])
result = {'data': [dict(zip(tuple (query.keys()) ,i)) for i in query.cursor]}
jsonData = json.dumps(result)
return jsonData
Code without request arguments:
@app.route("/data", methods=["GET"])
def data():
conn = e.connect()
query = conn.execute("SELECT * FROM coordinates")
result = {'data': [dict(zip(tuple (query.keys()) ,i)) for i in query.cursor]}
jsonData = json.dumps(result)
return jsonData
/r/flask
https://redd.it/694vki
reddit
[Ask Flask] Moving database from sqlite to postgres... • r/flask
My code is working fine if I use a sqlite database but raises a 400 Bad Request error when I use a postgres database. This error is raised when I...
Python equivalent for R Step-wise Regression (direction='Both')
I am trying to find a python version for R's Function(I forget which Library):
step(lm(y~x),direction='both')
In other words, I need a step-wise function that take the best AIC's from both forward and backwards, and return the correlated model (coefficients, p-values,and R value)
Is there one?
/r/pystats
https://redd.it/68pikh
I am trying to find a python version for R's Function(I forget which Library):
step(lm(y~x),direction='both')
In other words, I need a step-wise function that take the best AIC's from both forward and backwards, and return the correlated model (coefficients, p-values,and R value)
Is there one?
/r/pystats
https://redd.it/68pikh
reddit
Python equivalent for R Step-wise Regression... • r/pystats
I am trying to find a python version for R's Function(I forget which Library): step(lm(y~x),direction='both') In other words, I need a...
Help understanding flask sessions
I'm working on a flask app, and so far I haven't added any extensions, but eventually I want to have it employ a workflow something like the following
1) user visits the webapp
2) user uploads some text
3) the upload occurs over a web socket, using flask-socketio, which will then stay open long enough to deliver some analysis of the text
My question is this, what do I have to do to support multiple people accessing the site and using this workflow concurrently? Is it in the sockets, is it in user sessions, do I need to add user accounts? It's just not clear to me how my app should most easily know "this is a new text analysis run, separate from other users' runs that may be occurring."
Also, if anyone can recommend the ideal server for this setup, that would be most appreciated. I know flask-socketio has recommendations, but I don't know how to choose one.
FYI I'm using python 2.7.12 and flask 0.10.1.
Thank you anyone who can help!!!
/r/flask
https://redd.it/693p4k
I'm working on a flask app, and so far I haven't added any extensions, but eventually I want to have it employ a workflow something like the following
1) user visits the webapp
2) user uploads some text
3) the upload occurs over a web socket, using flask-socketio, which will then stay open long enough to deliver some analysis of the text
My question is this, what do I have to do to support multiple people accessing the site and using this workflow concurrently? Is it in the sockets, is it in user sessions, do I need to add user accounts? It's just not clear to me how my app should most easily know "this is a new text analysis run, separate from other users' runs that may be occurring."
Also, if anyone can recommend the ideal server for this setup, that would be most appreciated. I know flask-socketio has recommendations, but I don't know how to choose one.
FYI I'm using python 2.7.12 and flask 0.10.1.
Thank you anyone who can help!!!
/r/flask
https://redd.it/693p4k
reddit
Help understanding flask sessions • r/flask
I'm working on a flask app, and so far I haven't added any extensions, but eventually I want to have it employ a workflow something like the...
[AF] Which cache mechanism are you using?
Hi
I'm currently working on a rather big flask app and was wondering which cache mechanism you are using out there?
Are there many using flask-caching with redis/memcached or is there anything else recommended?
Thank you in advance
/r/flask
https://redd.it/68w7wj
Hi
I'm currently working on a rather big flask app and was wondering which cache mechanism you are using out there?
Are there many using flask-caching with redis/memcached or is there anything else recommended?
Thank you in advance
/r/flask
https://redd.it/68w7wj
reddit
[AF] Which cache mechanism are you using? • r/flask
Hi I'm currently working on a rather big flask app and was wondering which cache mechanism you are using out there? Are there many using...
Postgres Full-Text Search With Django
http://blog.lotech.org/postgres-full-text-search-with-django.html
/r/django
https://redd.it/6940gl
http://blog.lotech.org/postgres-full-text-search-with-django.html
/r/django
https://redd.it/6940gl
Lotechnica
Postgres Full-Text Search With Django
Django has added support for Postgres's built-in full-text searching as of version 1.10. This is a great alternative to a heavier search system such as elasticsearch or SOLR, when we want decent search capabilities without having to setup and maintain another…
Are there best practices for organizing methods between related models?
Hi everyone, I have been working with Django for a while and I really dig it. However I often feel I overcomplicate my code and get lost at determining where everthing is.
For example - one issue I am facing, and am hoping for some insight on, is the following.
I have an application that has Missions (a series of tasks) which get assigned to Members.
A simplified version of the code is
class Mission
title = Charfield
description = Textfield
class MemberMission
mission = Foreignkey to Mission
member = Foreignkey to Member (which is connected to User)
status = Charfield
custom_variables = Dictionaryfield. (holds other data about what they have done or not)
I just realized that I may want the mission description to depend on membermisson variables (eg. perhaps we give more time or less time or vary the reward based on these variables).
So, in the template, rather than showing the field mission.description, I should show a function (get_description) that pulls the description and modifies it based on the membermission data.
My question is this, where would a Django pro put this function?
Should it be on the Membermission
Eg) membermission.get_description()
Or should it be on the Mission
Eg) misson.get_description(membermission)
Or should I have it as a seperate function in some toolbox file (and put it into a template tag)
Eg) toolbox.get_description(membermission)
Or should I just find a source for Adderall and get over all this?
Thank you so much everyone.
/r/django
https://redd.it/696rdp
Hi everyone, I have been working with Django for a while and I really dig it. However I often feel I overcomplicate my code and get lost at determining where everthing is.
For example - one issue I am facing, and am hoping for some insight on, is the following.
I have an application that has Missions (a series of tasks) which get assigned to Members.
A simplified version of the code is
class Mission
title = Charfield
description = Textfield
class MemberMission
mission = Foreignkey to Mission
member = Foreignkey to Member (which is connected to User)
status = Charfield
custom_variables = Dictionaryfield. (holds other data about what they have done or not)
I just realized that I may want the mission description to depend on membermisson variables (eg. perhaps we give more time or less time or vary the reward based on these variables).
So, in the template, rather than showing the field mission.description, I should show a function (get_description) that pulls the description and modifies it based on the membermission data.
My question is this, where would a Django pro put this function?
Should it be on the Membermission
Eg) membermission.get_description()
Or should it be on the Mission
Eg) misson.get_description(membermission)
Or should I have it as a seperate function in some toolbox file (and put it into a template tag)
Eg) toolbox.get_description(membermission)
Or should I just find a source for Adderall and get over all this?
Thank you so much everyone.
/r/django
https://redd.it/696rdp
reddit
Are there best practices for organizing methods between... • r/django
Hi everyone, I have been working with Django for a while and I really dig it. However I often feel I overcomplicate my code and get lost at...
Do you wanna join to build a python documentation (a.k.a learn python with me)?
[Official python documentation](https://docs.python.org/2/) is great. [learnpythonthehardway](https://learnpythonthehardway.org/) and [python in tutorialspoint](https://www.tutorialspoint.com/python/) are very good too. With three years coding python, I'm writing my notes here [http://magizbox.com/training/python/site/](http://magizbox.com/training/python/site/). However, I found that no one care about this site.
So I write this text for beginner python programmers, do you find anything helpful in my website, do you wanna join with me to build a better and more useful documentation. With experienced programmers, would you please give me some advice to make my notes more useful for other programmers?
Thank all of you so much.
/r/Python
https://redd.it/695xtr
[Official python documentation](https://docs.python.org/2/) is great. [learnpythonthehardway](https://learnpythonthehardway.org/) and [python in tutorialspoint](https://www.tutorialspoint.com/python/) are very good too. With three years coding python, I'm writing my notes here [http://magizbox.com/training/python/site/](http://magizbox.com/training/python/site/). However, I found that no one care about this site.
So I write this text for beginner python programmers, do you find anything helpful in my website, do you wanna join with me to build a better and more useful documentation. With experienced programmers, would you please give me some advice to make my notes more useful for other programmers?
Thank all of you so much.
/r/Python
https://redd.it/695xtr
[Ask Flask] Is it possible to Auto generate a form thats based off a Database Schema onto a web page using WTForms and SQLAlchemy?
I want to make a simple web application that is a able to look at the fields of a database and generate a form onto a page for a user to fill in.
Im relatively new to Flask and thought It would be maybe possible by using SQLAlchemy and WTForms but wanted to get a second opinion as to what might be the best and easiest way to do this. Also, if you know any documentation that might be of use to me to get this done, can you please share. Thanks!
/r/flask
https://redd.it/696ivi
I want to make a simple web application that is a able to look at the fields of a database and generate a form onto a page for a user to fill in.
Im relatively new to Flask and thought It would be maybe possible by using SQLAlchemy and WTForms but wanted to get a second opinion as to what might be the best and easiest way to do this. Also, if you know any documentation that might be of use to me to get this done, can you please share. Thanks!
/r/flask
https://redd.it/696ivi
reddit
[Ask Flask] Is it possible to Auto generate a form thats... • r/flask
I want to make a simple web application that is a able to look at the fields of a database and generate a form onto a page for a user to fill...
100 days of algorithms in Python
https://medium.com/100-days-of-algorithms
/r/Python
https://redd.it/697865
https://medium.com/100-days-of-algorithms
/r/Python
https://redd.it/697865
100 days of algorithms
100 days, 100 algorithms - a challenge consisting of many small pieces
[Ask Flask] When running from terminal script, it opens two webpages instead of one
Hello, I've found almost the same question on stackoverflow but without accepted response. This is unresolved and after 3 hours I'm at my limit.
What do I have:
- `run.py` in `/this/location/run.py`
- `issues` symbolic link in `~/bin/issues --> /this/location/run.py`
What I want:
- user opens a terminal and writes `issues`, that starts a flask app and opens a google-chrome browser (one).
What it does:
- user opens a terminal, writes `issues`, that stats flask app, opens a browser, re-starts flask I think and opens another browser...
**`run.py`**:
#!/usr/bin/env python3
from flask import Flask
import webbrowser
from multiprocessing import Process
app = Flask(__name__)
@app.route('/')
def index():
return 'Index Page'
@app.route('/hello')
def hello():
return 'Hello, World'
def start_server(url):
print("START SERVER")
app.run(host="{}".format(url), debug=True)
def start_browser(url, port):
webbrowser.open_new("http://{url}:{port}/".format(url=url, port=port))
def main():
url, port = '0.0.0.0', '5000'
p1 = Process(target=start_server, args=(url,))
p2 = Process(target=start_browser, args=(url, port))
processes = list()
processes.append(p1)
processes.append(p2)
for p in processes:
p.start()
if __name__ == '__main__':
main()
**Terminal output:**:
(SonGokussj4@my_secret_machine) - (~) $ issues
START SERVER
* Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
* Restarting with stat
START SERVER
* Debugger is active!
* Debugger pin code: 165-476-411
127.0.0.1 - - [04/May/2017 16:53:48] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [04/May/2017 16:53:49] "GET / HTTP/1.1" 200 -
Anyone knows what the hell is happening?
/r/flask
https://redd.it/6980g8
Hello, I've found almost the same question on stackoverflow but without accepted response. This is unresolved and after 3 hours I'm at my limit.
What do I have:
- `run.py` in `/this/location/run.py`
- `issues` symbolic link in `~/bin/issues --> /this/location/run.py`
What I want:
- user opens a terminal and writes `issues`, that starts a flask app and opens a google-chrome browser (one).
What it does:
- user opens a terminal, writes `issues`, that stats flask app, opens a browser, re-starts flask I think and opens another browser...
**`run.py`**:
#!/usr/bin/env python3
from flask import Flask
import webbrowser
from multiprocessing import Process
app = Flask(__name__)
@app.route('/')
def index():
return 'Index Page'
@app.route('/hello')
def hello():
return 'Hello, World'
def start_server(url):
print("START SERVER")
app.run(host="{}".format(url), debug=True)
def start_browser(url, port):
webbrowser.open_new("http://{url}:{port}/".format(url=url, port=port))
def main():
url, port = '0.0.0.0', '5000'
p1 = Process(target=start_server, args=(url,))
p2 = Process(target=start_browser, args=(url, port))
processes = list()
processes.append(p1)
processes.append(p2)
for p in processes:
p.start()
if __name__ == '__main__':
main()
**Terminal output:**:
(SonGokussj4@my_secret_machine) - (~) $ issues
START SERVER
* Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
* Restarting with stat
START SERVER
* Debugger is active!
* Debugger pin code: 165-476-411
127.0.0.1 - - [04/May/2017 16:53:48] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [04/May/2017 16:53:49] "GET / HTTP/1.1" 200 -
Anyone knows what the hell is happening?
/r/flask
https://redd.it/6980g8
reddit
[Ask Flask] When running from terminal script, it opens... • r/flask
Hello, I've found almost the same question on stackoverflow but without accepted response. This is unresolved and after 3 hours I'm at my...
Why does default=False have to be explicitly set for BooleanField in models.py?
I have a number of fields in my models.py file which have "= models.BooleanField()" set.
However, 'makemigrations' is rejecting them, saying that the non-nullable field needs a default. I thought the default for BooleanField was False?
I can fix the problem by adding (default=False) to every single BooleanField but it seems ridiculous that I have to do this.
Might there be a simpler way to solve this problem?
Robert
/r/django
https://redd.it/699k83
I have a number of fields in my models.py file which have "= models.BooleanField()" set.
However, 'makemigrations' is rejecting them, saying that the non-nullable field needs a default. I thought the default for BooleanField was False?
I can fix the problem by adding (default=False) to every single BooleanField but it seems ridiculous that I have to do this.
Might there be a simpler way to solve this problem?
Robert
/r/django
https://redd.it/699k83
reddit
Why does default=False have to be explicitly set for... • r/django
I have a number of fields in my models.py file which have "= models.BooleanField()" set. However, 'makemigrations' is rejecting them, saying that...
DVC - Data Scientists’ Collaboration and Iterative Machine Learning written on Python
https://github.com/dataversioncontrol/dvc
/r/Python
https://redd.it/698ian
https://github.com/dataversioncontrol/dvc
/r/Python
https://redd.it/698ian
GitHub
GitHub - iterative/dvc: 🦉 Data Version Control | Git for Data & Models | ML Experiments Management
🦉 Data Version Control | Git for Data & Models | ML Experiments Management - GitHub - iterative/dvc: 🦉 Data Version Control | Git for Data & Models | ML Experiments Management
How have you automated your life with python? (if you have)
Hi, I'm learning python and need some inspiration. I saw another post on here but it was over 2 years old.
/r/Python
https://redd.it/69ba93
Hi, I'm learning python and need some inspiration. I saw another post on here but it was over 2 years old.
/r/Python
https://redd.it/69ba93
reddit
How have you automated your life with python? (if you have) • r/Python
Hi, I'm learning python and need some inspiration. I saw another post on here but it was over 2 years old.