Title
stringlengths
11
150
A_Id
int64
518
72.5M
Users Score
int64
-42
283
Q_Score
int64
0
1.39k
ViewCount
int64
17
1.71M
Database and SQL
int64
0
1
Tags
stringlengths
6
105
Answer
stringlengths
14
4.78k
GUI and Desktop Applications
int64
0
1
System Administration and DevOps
int64
0
1
Networking and APIs
int64
0
1
Other
int64
0
1
CreationDate
stringlengths
23
23
AnswerCount
int64
1
55
Score
float64
-1
1.2
is_accepted
bool
2 classes
Q_Id
int64
469
42.4M
Python Basics and Environment
int64
0
1
Data Science and Machine Learning
int64
0
1
Web Development
int64
1
1
Available Count
int64
1
15
Question
stringlengths
17
21k
Does the order of decorators matter on a Flask view?
28,204,335
23
15
3,907
0
python,flask,python-decorators,flask-login
While there probably won't be any problem in this case no matter what the order, you probably want login_required to execute first so that you don't make queries and paginate results that will just get thrown away. Decorators wrap the original function bottom to top, so when the function is called the wrapper added by ...
0
0
0
0
2015-01-28T23:01:00.000
4
1.2
true
28,204,071
0
0
1
1
I'm using the login_required decorator and another decorator which paginates output data. Is it important which one comes first?
Run python script every 5 minutes under Windows
28,215,366
3
3
11,625
0
python
If you are using Windows i would suggest using Windows Task Scheduler, it's quite simple thanks to the UI and from there Trigger your Python code. For a server environment like Linux you could set up a Cron task.
0
0
1
0
2015-01-29T12:46:00.000
2
0.291313
false
28,215,153
0
0
1
1
I am having a simple python script scraping some data from html page and writing out results to a csv file. How can I automate the scraping, i.e. kick it off every five minutes under Windows. Thanks Peter
Running different stacks on same cloud instance
28,217,518
0
0
31
0
php,python,wordpress,amazon-web-services
If you can run it on the same physical server, you can run it on an EC2 server the same way. There is no difference as far as that is concerned.
0
0
0
1
2015-01-29T13:46:00.000
2
0
false
28,216,315
1
0
1
1
I'm running a Python-based application on an AWS instance but now I want to install a Wordpress (PHP) blog as a sub-domain or as a sub-folder as an addition in the application. Is it technically possible to run two different stack applications on a single cloud instance? Currently getting an inscrutable error installin...
Django + Angular deployment on Heroku
28,218,300
1
5
2,836
0
python,django,angularjs,heroku
There's nothing particularly special about this setup. Angular code is just static files, and can be served from whatever point you want; then the Ajax calls to the REST backend go to the endpoint you determined.
0
0
0
0
2015-01-29T13:58:00.000
2
0.099668
false
28,216,549
0
0
1
1
I have a project consisting of the Django Rest Backend and AngularJS frontend. The project root directory contains two folders: backend and frontend, in the first one there is placed the whole Django app and in the second one the Angular frontend app. Is it possible to deploy such a structure to Heroku in one subdomain...
Python - BeautifulSoup - German characters in html
42,434,749
0
0
580
0
python,html
While reading assign text to an variable and the decode it, like if your text is stored under variable Var, then while reading use Var.decode("utf-8").
0
0
0
0
2015-01-30T11:11:00.000
1
0
false
28,234,634
0
0
1
1
Dear friendly python experts, I am using BeautifulSoup to scrape some html text from a site. This site contains German words, such as "Groß" or "Bär". When I print the html text these characters get translated quite nasty making it too hard to search the html text for the words then. How can I replace ß to ss, ä to ae...
Django/Postgres: FATAL: remaining connection slots are reserved for non-replication superuser connections
28,395,905
4
2
3,434
1
python,django,postgresql,heroku,django-queryset
I realized that I was using the django server in my procfile. I accidentally commented out and commited it to heroku instead of using gunicorn. Once I switched to gunicorn on the same heroku plan the issue was resolved. Using a production level application server really makes a big difference. Also don't code at crazy ...
0
0
0
0
2015-01-30T14:35:00.000
1
1.2
true
28,238,144
0
0
1
1
Recently I've been receiving this error regarding what appears to be an insufficiency in connection slots along with many of these Heroku errors: H18 - Request Interrupted H19 - Backend connection timeout H13 - Connection closed without response H12 - Request timeout Error django.db.utils.OperationalError in / FATAL:...
Flask isn't recognising connections from other clients
28,257,714
0
0
48
0
python,flask
you need to configure your firewall on your server/workstation to allow connections on port 5000. setting the ip to 0.0.0.0 allows connections to your machine but only if you have the port open. also, you will need to connect via the ip of your machine and not localhost since localhost will only work from the machine...
0
0
0
0
2015-01-31T16:29:00.000
1
0
false
28,253,855
0
0
1
1
I have an apache server setup on a Pi, and i'm trying to learn Flask. I set it up so that The 'view' from the index '/' returns "hello world". then i ran my main program. nothing happens from the browser on the PC i'm SSH'ing from,I just get an error saying , but when i used the Pi directly and went to http:localhost:5...
Handling user database in flask web app without ORM like SQLAlchemy
28,280,443
0
2
970
1
python,sql,orm,flask,sqlalchemy
No, an ORM is not required, just incredibly convenient. SQLAlchemy will manage connections, pooling, sessions/transactions, and a wide variety of other things for you. It abstracts away the differences between database engines. It tracks relationships between tables in convenient collections. It generally makes wor...
0
0
0
0
2015-02-02T05:39:00.000
1
0
false
28,271,711
0
0
1
1
Most of the Flask tutorials and examples I see use an ORM such as SQLAlchemy to handle interfacing with the user database. If you have a general working knowledge of SQL, is this extra level of abstraction, heavy with features, necessary? I am tempted to write a lightweight interface/ORM of my own so I better understan...
Google App Engine Python Search Api's Location-based queries (Geosearch) Issues
29,008,682
0
0
248
0
python,google-app-engine,google-search-api,google-app-engine-python
There can be two reasons for this : 1 - miles instead of km 2 - conversion numbers (for example 35,322.2 is 35322.2 ? km ? miles ?) i suggest to check what exactly are the numbers processed when executing distance function, you can programmatically output this data in some logs Hope it helps
0
1
0
0
2015-02-02T06:30:00.000
1
0
false
28,272,226
0
0
1
1
I have implemented GAE's Python Search Api and am trying to query based on distance from given geopoint. My query string is: "distance(location, geopoint(XXX, YYY)) < ZZZ". However, for some reason on the production server, this query string is returning items where the distance is greater than the ZZZ parameter. Below...
Share object between django users
28,293,569
0
3
1,011
0
python,django
You no need any magic to do singleton-like object in python. Just write module, for example shared.py inside your django project. Put your dictionary initialization here and import it from anywhere.
0
0
0
0
2015-02-03T06:15:00.000
3
0
false
28,292,538
0
0
1
2
I have an application and a database. The application initially was written in python without django. What seems to be the problem is that it makes too many connections with the database and that slows it down. What I want to do is load whatever data is going to be used in python dictionary and then share that object w...
Share object between django users
28,294,419
1
3
1,011
0
python,django
Contrary to your assertion, Django does not reinitialize on every request. Actually, Django processes last for many requests, and anything defined at module level will be shared across all requests handled by that process. This can often be a cause of thread safety bugs, but in your case is exactly what you want. Of co...
0
0
0
0
2015-02-03T06:15:00.000
3
1.2
true
28,292,538
0
0
1
2
I have an application and a database. The application initially was written in python without django. What seems to be the problem is that it makes too many connections with the database and that slows it down. What I want to do is load whatever data is going to be used in python dictionary and then share that object w...
get first object in mongoengine
28,293,187
6
3
2,821
0
python,mongodb,flask,mongoengine
It's simple just use : Request.objects.first()
0
0
0
0
2015-02-03T06:59:00.000
1
1.2
true
28,293,096
0
0
1
1
I have a class with name of Request and I want to get first object of it in mongoengine I think I can use this : first get all objects like this visitors = Request.objects.all()and then ss = visitors[0].ip and then call an attribute of object
Empty request.FILES in Django
28,295,685
3
2
3,002
0
python,django,forms,post
Should I use exactly multipart/form-data content-type? Django supports only multipart/form-data, so you must use that content-type. Where can I specify enctype? (headers, parameters, etc) in normal HTML just put enctype="multipart/form-data" as one of parameters of your form element. In HttpRequester it's more co...
0
0
1
0
2015-02-03T09:08:00.000
1
0.53705
false
28,295,059
0
0
1
1
I'm trying to send a file via post request to server on localhost. I'm using HttpRequester in Firefox (also tried Postman in Chrome and Tasker on Android) to sumbit request. The problem is that request.FILES is always empty. But when I try to print request.body it shows some non-human-readable data which particularly i...
how to run Apache with mod_wsgi and django in one process only?
28,320,868
0
1
444
0
django,python-2.7,apache2,mod-wsgi,pyinotify
You shouldn't prevent spawning multiple processes, because it's good thing, especially on production environment. You should consider using some external tool, separated from django or add check if folder listening is already running (for example monitor persistence of PID file and it's content).
0
0
0
0
2015-02-04T09:42:00.000
2
0
false
28,318,105
0
0
1
2
I'm running apache with django and mod_wsgi enabled in 2 different processes. I read that the second process is a on-change listener for reloading code on change, but for some reason the ready() function of my AppConfig class is being executed twice. This function should only run once. I understood that running django ...
how to run Apache with mod_wsgi and django in one process only?
28,321,203
2
1
444
0
django,python-2.7,apache2,mod-wsgi,pyinotify
No, the second process is not an onchange listener - I don't know where you read that. That happens with the dev server, not with mod_wsgi. You should not try to prevent Apache from serving multiple processes. If you do, the speed of your site will be massively reduced: it will only be able to serve a single request at...
0
0
0
0
2015-02-04T09:42:00.000
2
0.197375
false
28,318,105
0
0
1
2
I'm running apache with django and mod_wsgi enabled in 2 different processes. I read that the second process is a on-change listener for reloading code on change, but for some reason the ready() function of my AppConfig class is being executed twice. This function should only run once. I understood that running django ...
Opening pages asynchronously in headless browser (PhantomJS)
28,319,699
2
1
691
0
python,selenium-webdriver,phantomjs,headless-browser,ghostdriver
If you want to bypass ghostdriver, then you can directly write your PhantomJS scripts in JavaScript or CoffeeScript. As far as I know there is no way of doing this with the selenium webdriver except with different threads in the language of your choice (python). If you are not happy with it, there is CasperJS which has...
0
0
1
0
2015-02-04T10:55:00.000
2
1.2
true
28,319,579
0
0
1
1
I am using PhantomJS via Python through Selenium+Ghostdriver. I am looking to load several pages simultaneously and to do so, I am looking for an async method to load pages. From my research, PhantomJS already lives in a separate thread and supports multiple tabs, so I believe the only missing piece of the puzzle is a ...
IQtNetwork.QHttp request credential issue
28,327,369
1
1
49
0
python,qt,pyqt,twisted,twisted.web
So i figured out that Qt isn't sending the TWISTED_SESSION cookie back with subsequent requests. all i did was send the cookie along with subsequent requests and it worked fine. i had to sqitch to python's request to ease things
0
0
1
0
2015-02-04T14:56:00.000
1
0.197375
false
28,324,393
0
0
1
1
I am currently authenticating via a RESTful http api that generates a token which is then used for subsequent request. The api server is written with python twisted and works great the auth token generation works fine in browsers When requesting from software written in pyqt the first request hands over a token to the ...
GoogleAppEngine error directory not found
28,340,241
1
0
95
0
google-app-engine,python-2.7,google-app-engine-python
Your full project path contains two space characters and needs to be quoted, also, a trailing slash might be required i.e.: C:\Python27\python.exe appcfg.py update "C:\Users\alastair\Desktop\School Files\Proxy Files\mirrorrr-master\mirrorrr-master\" assuming that's where you have your app.yaml file. In your case it's t...
0
1
0
0
2015-02-05T08:57:00.000
1
0.197375
false
28,339,778
0
0
1
1
Ive been working on get a proxy working for when im school, to access sites that i use alot for work but my school dont like.. This is the error it comes up with when i try to upload the files to googles app engine.. C:\Program Files (x86)\Google\google_appengine>"C:\Python27\python.exe" appcfg.p y update C:\Users\ala...
How to proceed after Implementing django tenant schemas
28,382,483
1
0
594
0
python,django,postgresql
If you are using Linux you just have to add that domain name in /etc/hosts and access it like it is a real domain name. Another solution is to make that domain name to point to 127.0.0.1 while you don't push the changes to production. I'd go with the first idea though.
0
0
0
0
2015-02-06T05:53:00.000
1
1.2
true
28,359,414
0
0
1
1
I have successfully implemented django-tenant-schema in my project. It also creates separate schema for each user after they got registered.Suppose if a customer named 'customer1' is successfully logged in, then he will redirect to "customer1.domainname.com".So please suggest me a solution to test if this is working in...
Webpage ping when active
28,397,610
1
0
47
0
python,google-app-engine,web
The best way is to ping the server while the user is online. Using other methods such as the Channel API with GAE proves to be unreliable since you are not constantly sending a ping message but rather just sending a disconnect message. If the browser crashes, no disconnect message is sent.
0
1
0
0
2015-02-08T03:29:00.000
1
1.2
true
28,390,253
0
0
1
1
I want a way for users to open this webpage, and whenever they are on that page, it updates the server that they are on the page. It should only work when the user is actually looking at the webpage (not inactive, like from switchings tabs). One way to do this which I have implemented is to keep pinging the server sayi...
In a Django web application, would large files or many unnecessary import statements slow down my server?
28,399,223
1
0
62
0
python,django
No, code speed is not affected by the size of your modules. Additional imports only affect the memory footprint (a little more memory is needed to hold the extra code objects) and startup speed (more files are loaded from disk when your Django server starts). However, this doesn't really affect code running speeds; Pyt...
0
0
0
0
2015-02-08T20:39:00.000
2
1.2
true
28,399,120
0
0
1
2
In my Django web app, I have pretty much one large file that contains all my views. This has a ton of imported python libraries that are only used for certain views. Does this slow my code? Like in python does importing things like python natural language toolkit (nlkt) and threading libraries slow down the code wh...
In a Django web application, would large files or many unnecessary import statements slow down my server?
28,399,156
0
0
62
0
python,django
Views load only one time, at the moment of start your code
0
0
0
0
2015-02-08T20:39:00.000
2
0
false
28,399,120
0
0
1
2
In my Django web app, I have pretty much one large file that contains all my views. This has a ton of imported python libraries that are only used for certain views. Does this slow my code? Like in python does importing things like python natural language toolkit (nlkt) and threading libraries slow down the code wh...
Robot Framework can't find Python
41,825,897
1
1
1,818
0
python,robotframework
Try to add the following path in environment variable also: "C:\Python27\Lib\site-packages" Since this path consists all the third party modules installed on your PC and also verify if robot-framework library is present in this folder.
0
0
0
1
2015-02-09T15:44:00.000
2
0.099668
false
28,413,567
1
0
1
2
I'm trying to install Robot Framework, but it keeps giving me an error message during setup that "No Python installation found in the registry." I've tried running the installer as administrator, I've made sure that Python is installed (I've tried both 2.7.2 and 2.7.9), and both C:\Python27 and C:\Python27\Scripts are...
Robot Framework can't find Python
28,443,946
0
1
1,818
0
python,robotframework
I faced the same issue. Install a different bit version of ROBOT framework. In my case, I was first trying to install 64bit version but it said "No Python installation found in the registry." Then I tried to install the 32bit version of ROBOT framework and it worked. So there is nothing wrong with your Python versio...
0
0
0
1
2015-02-09T15:44:00.000
2
0
false
28,413,567
1
0
1
2
I'm trying to install Robot Framework, but it keeps giving me an error message during setup that "No Python installation found in the registry." I've tried running the installer as administrator, I've made sure that Python is installed (I've tried both 2.7.2 and 2.7.9), and both C:\Python27 and C:\Python27\Scripts are...
Mac OSX Trouble Running pip commands
35,575,253
0
0
797
0
python,django,macos,pip
Try adding sudo. sudo pip install Django
0
1
0
0
2015-02-10T01:19:00.000
2
0
false
28,422,520
0
0
1
2
I recently installed Python 3.4 on my Mac and now want to install Django using pip. I tried running pip install Django==1.7.4 from the command line and received the following error: Exception: Traceback (most recent call last): File "/Library/Python/2.7/site-packages/pip-6.0.8-py2.7.egg/pip/basecommand.py", line ...
Mac OSX Trouble Running pip commands
70,606,374
0
0
797
0
python,django,macos,pip
Try to create a virtual environment. This can be achieved by using python modules like venv or virtualenv. There you can change your python path without affecting any other programs on your machine. If then the error is is still that you do not have permission to read files, try sudo pip install. But only as a last res...
0
1
0
0
2015-02-10T01:19:00.000
2
0
false
28,422,520
0
0
1
2
I recently installed Python 3.4 on my Mac and now want to install Django using pip. I tried running pip install Django==1.7.4 from the command line and received the following error: Exception: Traceback (most recent call last): File "/Library/Python/2.7/site-packages/pip-6.0.8-py2.7.egg/pip/basecommand.py", line ...
PHP-Python - killing python process leads memory leak?
28,453,222
1
0
71
0
php,python,memory,memory-management
No. When a process is killed, the operating system releases all operating system resources (memory, sockets, file handles, …) previously acquired by that process.
0
0
0
1
2015-02-11T11:28:00.000
1
1.2
true
28,453,194
0
0
1
1
I am writing PHP-Python web application for a webApp scanner where web application is managed by PHP and scanning service is managed by python. My question is if I kill a running python process with PHP, does it cause any memory leak or any other trouble (functionality-wise I handled it already)
Is CapeDwarf compatible with Python GAE?
28,474,564
1
1
105
0
python,google-app-engine,capedwarf
Yes, as Alex posted - CapeDwarf is Java only.
0
1
0
0
2015-02-12T01:08:00.000
2
0.099668
false
28,467,558
0
0
1
1
I'm trying to deploy my GAE application - written with Python - on CapeDwarf (WildFly_2.0.0.CR5). But all the documentation talking only about Java Application. So is CapeDwarf can deploy Python Application ? if it is, how to do it ? else any other application that can ?
Sublime Text 3 - Plugin Profiles
40,161,595
0
6
1,302
0
java,python,sublimetext,sublimetext3,sublime-text-plugin
In windows 10 if you delete this folder --> C:\Users\USER\AppData\Roaming\Sublime Text 3 then sublime text will default back to its original state. Maybe if you setup a batch file to keep different versions of this folder for example": "./Sublime Text 3_Java" or "./Sublime Text 3_Python" or "./Sublime Text 3_C++" an...
0
0
0
1
2015-02-12T02:36:00.000
2
0
false
28,468,321
0
0
1
2
I am currently using Sublime Text 3 for programming in Python, Java, C++ and HTML. So, for each language I have a different set of plugins. I would like to know if there is a way for changing between "profiles", with each profile containing plugins of the respective language. My PC is not all that powerful, so it start...
Sublime Text 3 - Plugin Profiles
28,504,749
2
6
1,302
0
java,python,sublimetext,sublimetext3,sublime-text-plugin
The easiest way I can think of doing this on Windows is to have multiple portable installs, each one set up for your programming language and plugin set of your choice. You can then set up multiple icons on your desktop/taskbar/start menu/whatever, each one pointing to a different installation. This way you don't have ...
0
0
0
1
2015-02-12T02:36:00.000
2
0.197375
false
28,468,321
0
0
1
2
I am currently using Sublime Text 3 for programming in Python, Java, C++ and HTML. So, for each language I have a different set of plugins. I would like to know if there is a way for changing between "profiles", with each profile containing plugins of the respective language. My PC is not all that powerful, so it start...
Checking file type with django form: 'application/octet-stream' issue
28,474,553
0
0
3,271
0
python,django,django-forms,mime-types
You should not rely on the MIME type provided, but rather the MIME type discovered from the first few bytes of the file itself. This will help eliminate the generic MIME type issue. The problem with this approach is that it will usually rely on some third party tool (for example the file command commonly found on Linux...
0
0
0
0
2015-02-12T09:20:00.000
3
0
false
28,473,613
0
0
1
1
I'm using django validators and python-magic to check the mime type of uploaded documents and accept only pdf, zip and rar files. Accepted mime-types are: 'application/pdf’, 'application/zip’, 'multipart/x-zip’, 'application/x-zip-compressed’, 'application/x-compressed', 'application/rar’, 'application/x-rar’ 'applic...
What's the right way to handle an initial database migration in Django?
28,486,071
2
0
129
0
python,django
You're going wrong at the very end -- yes, you do need to call manage.py makemigrations <appname> for each of your apps once. It's not automatically done for all apps. Presumably that is because Django has no way of knowing if that is what you want to do (especially if some apps were downloaded from PyPI, etc). And a s...
0
0
0
0
2015-02-12T19:03:00.000
1
1.2
true
28,485,685
0
0
1
1
I'm in the process of preparing a Django application for its initial production release, and I have deployed development instances of it in a few different environments. One thing that I can't quite get happening as smoothly as I'd like is the initial database migration. Given a fresh installation of Django, a deployme...
Can I connect a flask app to a database using MySQLdb-python vertica_python?
28,502,445
0
0
224
1
python,flask,flask-sqlalchemy
Yes, it is possible. I was having difficulties debugging because of the opacity of the error, but ran it with app.run(debug=True), and managed to troubleshoot my problem.
0
0
0
0
2015-02-12T23:21:00.000
1
0
false
28,489,779
0
0
1
1
Is it possible to connect a Flask app to a database using MySQLdb-python and vertica_python? It seems that the recommended Flask library for accessing databases is Flask-SQLAlchemy. I have an app that connects to MySQL and Vertica databases, and have written a GUI wrapper for it in Flask using flask-wtforms, but am ju...
what tools can be used to debug python / django code on a remote hosts without graphical UI
28,491,949
1
0
158
0
python,django,vim
I think the best practice is developing locally, and use Pycharm "sync" to deploy the code from local to remote. If you prefer to code without GUI or in the console mode, you could try "emacs+jedi", it works well in the console mode. For debug, the best choice is pydev/pdb.
0
0
0
0
2015-02-13T03:20:00.000
3
0.066568
false
28,491,923
1
0
1
1
I started develop python / django code recently. When I do it on my local machine (Ubuntu desktop), I use PyCharm, which I like a lot, because I can set up break points, and, when an exception occurs, it shows me the line in the code to which that exception relates. Are there any tools available for python / django dev...
django modelform display blank for null
28,510,476
0
0
432
0
python,django
Instead I ended up using forms.HiddenInput() and did not display the field with null, which fits my case perfectly well!
0
0
0
0
2015-02-13T07:36:00.000
2
0
false
28,494,629
0
0
1
1
In django model form, how to display blank for null values i.e prevent display of (None) on the form .Using postgresql, django 1.6.5. I do not wish to add space in the model instance for the allowed null values.
Dependencies between two Django projects
28,505,992
0
0
79
0
python,django,import,reference,dependencies
PyCharm adds only source folders automatically to the python path. So I marked app1 as a source folder and everything works.
0
0
0
0
2015-02-13T17:04:00.000
1
1.2
true
28,504,861
0
0
1
1
I have a question concerning dependencies between two Django projects. I have two Django Projects, P1 and P2. I want to import a form model from P2 > apps > app1 > forms > form.py. I marked P1 as depending on P2 (using Pycharm) and tried to use from app1.forms import form.py inside my model.py file of an app in P1. PyC...
Google NDB: Adding an entity with non existing parent
28,513,820
4
1
168
0
python,google-app-engine,google-cloud-datastore
You can create a key for any entity whether this entity exists or not. This is because a key is simply an encoding of an entity kind and either an id or name (and ancestor keys, if any). This means that you can store a child entity before a parent entity is saved, as long as you know the parent's id or name. You cannot...
0
1
0
0
2015-02-14T08:18:00.000
2
0.379949
false
28,513,774
0
0
1
1
I am working on a web application based on Google App Engine (Python / Webapp2) and Google NDB Datastore. I assumed that if I tried to add a new entity using as parent key the key of a no longer existing entity an exception was thrown. I have instead found the entity is actually created. Am i doing something wrong? I...
Why java String.length gives different result than python len() for the same string
28,524,245
1
4
673
0
java,python,string
If you use u"" before the string, which means unicode in python2.x, then you would possibly get the same result with Java
0
0
0
0
2015-02-15T08:17:00.000
3
0.066568
false
28,524,215
0
0
1
1
I have a string like the follwoing ("استنفار" OR "الأستنفار" OR "الاستنفار" OR "الإستنفار" OR "واستنفار" OR "باستنفار" OR "لستنفار" OR "فاستنفار" OR "والأستنفار" OR "بالأستنفار" OR "للأستنفار" OR "فالأستنفار" OR "والاستنفار" OR "بالاستنفار" OR "فالاستنفار" OR "والإستنفار" OR "بالإستنفار" OR "للإستنفار" OR "فالإستنفار" ...
Django __gt filter return the duplicate item
28,538,381
0
1
163
0
python,django
Django is storing time in database with more precision, than seconds. So if you time_at holds exact time of 12:45:44, query for database will retrieve fields that have time more than that just by miliseconds, so time of field retrieved from database can have 12:45:44.231 and it will be retrieved.
0
0
0
0
2015-02-15T20:38:00.000
2
0
false
28,530,885
0
0
1
1
I want to fetch items from my model by using time_created as criteria. If the latest item I fetched was posted at 12:45:44, I store it in request.session['time_at'] = 12:45:44 and use it to fetch item that are later than the last fetched. new_notice = Notify.objects.filter(time_created__gt = request.session['time_at']...
How to create a unique random username for django?
28,533,371
2
3
2,119
0
python,django,django-1.7
No, django doesn't have such function. So you have to check for the existence of the generated username in the loop.
0
0
0
0
2015-02-16T01:33:00.000
2
1.2
true
28,533,354
0
0
1
1
I want visitors of my page to be able to create entries without registering first. When they register later I want everything they have created within that session to belong to their user account. To achieve that I just want to create blank users with random usernames when entries from non users are made. What is the m...
unregister or register models conditionally in django admin
28,538,705
0
4
1,619
0
python,django,django-models,django-admin,django-admin-tools
I've tried a couple of approaches locally, including overriding an AdminSite, but given the fact that all admin-related code is loaded when the app is initialized, the simplest approach would be to rely on permissions (and not give everyone superuser access).
0
0
0
0
2015-02-16T09:43:00.000
2
0
false
28,538,461
0
0
1
1
Is it possible to conditionally register or unregister models in django admin? I want some models to appear in django admin, only if request satisfies some conditions. In my specific case I only need to check if the logged in user belongs to a particular group, and not show the model if the user (even if superuser) is ...
Django Rest frameworks: request.Post vs request.data?
28,545,657
29
23
8,970
0
python,django,rest,django-rest-framework
The docs cover this: request.data returns the parsed content of the request body. This is similar to the standard request.POST and request.FILES attributes except that: It includes all parsed content, including file and non-file inputs. It supports parsing the content of HTTP methods other than POST, meaning that you...
0
0
0
0
2015-02-16T16:06:00.000
2
1.2
true
28,545,553
0
0
1
1
The Django Rest Frameworks has this to say about POST, quoting a Django dev Requests If you're doing REST-based web service stuff ... you should ignore request.POST. — Malcom Tredinnick, Django developers group As not-so experienced web-developer, why is request.POST (standard) discouraged over request.DATA (non-stan...
Auto image resizing/compressing using python/django
28,550,992
0
0
162
0
python,django,image,web
Have multiple copies on the same image on different resolution on the server, and serve the correct one according to screen size using CSS media queries
0
0
0
0
2015-02-16T19:21:00.000
1
1.2
true
28,548,813
0
0
1
1
I'm working on a responsive website that uses Django and a lot of the content is static. Most of this content are photos of high resolution and because of this, it takes too much time to load. Is there any way (using python/django) to make it so that to load such an image, a server request is made and then a function ...
Django - how can I have a field in my model consisting of tuple of integers?
28,551,333
0
0
339
0
python,django
Depends on how you intend to use them after storing in the database; 2 methods I can think of are: Option 1) models.IntegerField(unique=True) now the trick is loading data and parsing it: you would have to concatenate the numbers then have a way to split them back out. fast would be Option 2) models.CommaSeparatedInteg...
0
0
0
0
2015-02-16T21:58:00.000
1
0
false
28,551,063
0
0
1
1
I am defining the models for my Django app, and I would like to have a field for a model consisting of a tuple of two (positive) integers. How can I do this? I'm looking at the Django Models API reference but I can't see any way of doing this.
Which HTTP method should I use to update a session attribute?
28,561,881
3
3
131
0
python,django,http,standards
I personally don't ever consider it safe to use GET for a request that will have side effects. I try to always follow the practice of POST + redirection to another page. This solves all kinds of problems, such as F5 refreshing the action, the user bookmarking a URL which has a side effect and so on. In your case, the u...
0
0
0
0
2015-02-17T12:32:00.000
1
1.2
true
28,561,598
0
0
1
1
If I have a view which the only purpose is to update a value in my session, is it safe to use it over GET or should I use POST and CSRF protection? The value modified in the session is only used to change the user's context and if somebody manage to change the user's context in his own browser that should be harmless.
Is there a point to setting __all__ and then using leading underscores anyway?
28,572,917
5
5
234
0
python,cpython
Aside from the "private-by-convention" functions with _leading_underscores, there are: Quite a few imported names; Four class names; Three function names without leading underscores; Two string "constants"; and One local variable (nobody). If __all__ wasn't defined to cover only the classes, all of these would also b...
0
0
0
0
2015-02-17T22:55:00.000
3
1.2
true
28,572,764
0
0
1
2
I've been reading through the source for the cpython HTTP package for fun and profit, and noticed that in server.py they have the __all__ variable set but also use a leading underscore for the function _quote_html(html). Isn't this redundant? Don't both serve to limit what's imported by from HTTP import *? Why do they ...
Is there a point to setting __all__ and then using leading underscores anyway?
28,572,885
5
5
234
0
python,cpython
__all__ indeed serves as a limit when doing from HTTP import *; prefixing _ to the name of a function or method is a convention for informing the user that that item should be considered private and thus used at his/her own risk.
0
0
0
0
2015-02-17T22:55:00.000
3
0.321513
false
28,572,764
0
0
1
2
I've been reading through the source for the cpython HTTP package for fun and profit, and noticed that in server.py they have the __all__ variable set but also use a leading underscore for the function _quote_html(html). Isn't this redundant? Don't both serve to limit what's imported by from HTTP import *? Why do they ...
How to use the Python getpass.getpass in PyCharm
32,341,555
6
33
22,724
0
python,pycharm
I've run into this running Pycharm CE 4.5 on Windows. The workaround I use is to run your program in debug mode, then you get a console tab where you can enter your password when using getpass.
0
0
0
0
2015-02-18T08:56:00.000
6
1
false
28,579,468
1
0
1
1
I have found getpass does not work in PyCharm. It just hangs. In fact is seems msvcrt.getch and raw_input also don't work, so perhaps the issue is not with getpass. Instead with the 'i' bit of PyCharm's stdio handling. The problem is, I can't put my personal password into code as it would end up in SVN which would be ...
Django app - deploy using UWSGI or Phusion Passenger
28,599,998
2
1
760
0
python,django,deployment,passenger,uwsgi
Production performance is pretty the same, so I wouldn't worry about that. uWSGI has some advanced builtin features like clustering and a cron API while Phusion Passenger is more minimalist, but Phusion Passenger provides more friendly tools for administration and inspection (e.g. passenger-status, passenger-memory-sta...
0
1
0
0
2015-02-19T01:27:00.000
1
0.379949
false
28,597,205
0
0
1
1
Which way of deploying Django app is better (or maybe the better question would be what are pros and cons): using UWSGI, using Phusion Passenger? In my particular case the most important advantage for using Passenger is ease of use (on my hosting I need to place single file in project directory and it's done), but wh...
Django's "call_command" hangs the application
28,642,118
1
1
347
0
python,django,parallel-processing,celery,mongoengine
When you make the synchronous calls to external systems it will tie up a thread in the application server, so depending on application server you choose and how many concurrent threads/users you have will determine whether doing it that way will work for you. Usually when you have long running requests like that it is ...
0
1
0
0
2015-02-19T11:50:00.000
1
1.2
true
28,605,646
0
0
1
1
I'm working on a project that uses Django and mongoengine. When a user presses a button, a trigger to a call_command (django.core.management - just calls a script it seems to me) is made which sshs to multiple servers in parallel, copies some files, parses them and stores them in the database. The problem is that when ...
How do I design an API such that code updates don't cause interruptions?
28,629,932
1
0
33
0
python,api,high-availability
actually there is no silver bullet. you mention two different things. one is availability. it depends on how many nines you want to have in your 9,999... availability. second thing is api change. so: availability: some technologies allows you to do hot changes/deloyments. which means pending requests goes the old path...
0
0
1
0
2015-02-20T09:23:00.000
1
1.2
true
28,625,474
0
0
1
1
I'm planning to deliver an API as a web-service. When I update my API's (interpreted) code-base, however, I anticipate possibly needing to restart the API service or even just have a period where the code is being overwritten. This introduces the possibility that incoming API requests may be dropped or, even worse, tha...
column "is_superuser" is of type integer but expression is of type boolean DJANGO Error
28,636,553
0
0
2,600
1
django,python-3.x,heroku,heroku-postgres
It seems to me that you are using raw SQL queries instead of Django ORM calls and this causes portability issues when you switch database engines. I'd strongly suggest to use ORM if it's possible in your case. If not, then I'd say that you need to detect database engine on your own and construct queries depending on cu...
0
0
0
0
2015-02-20T18:50:00.000
3
0
false
28,636,141
0
0
1
2
I could use some help. My python 3.4 Django 1.7.4 site worked fine using sqlite. Now I've moved it to Heroku which uses Postgres. And when I try to create a user / password i get this error: column "is_superuser" is of type integer but expression is of type boolean LINE 1: ...15-02-08 19:23:26.965870+00:00', "is_su...
column "is_superuser" is of type integer but expression is of type boolean DJANGO Error
28,638,965
-1
0
2,600
1
django,python-3.x,heroku,heroku-postgres
The problem is caused by a variable trying to change data types (i.e. from a char field to date-time) in the migration files. A database like PostgreSQL might not know how to change the variable type. So, make sure the variable has the same type in all migrations.
0
0
0
0
2015-02-20T18:50:00.000
3
-0.066568
false
28,636,141
0
0
1
2
I could use some help. My python 3.4 Django 1.7.4 site worked fine using sqlite. Now I've moved it to Heroku which uses Postgres. And when I try to create a user / password i get this error: column "is_superuser" is of type integer but expression is of type boolean LINE 1: ...15-02-08 19:23:26.965870+00:00', "is_su...
openFile with pandoc 1.13.2 - Windows 8.1
28,641,007
0
0
173
0
windows,ipython-notebook,pandoc
I finally solve my problem by adding the full paths to my files (But I have used wkhtmltopdf which is simpler to use for a good result.)
0
0
0
0
2015-02-20T23:53:00.000
1
0
false
28,640,234
1
0
1
1
sorry for my english in my post (it is my first on this forum, and my question is perhaps stupid). I encounter a problem in converting a html file to pdf file with pandoc. Here is my code in the console set Path=%Path%;C:\Users\nicolas\AppData\Local\Pandoc (redirecting to Pandoc directory) followed by pandoc --data-d...
How can i add junit test for a java program using python for continuous integration in jenkins
31,576,925
0
0
516
0
java,python,junit,jenkins,continuous-integration
Jenkins allows you to run any external command so you can just call your Python script afterwards
0
0
0
1
2015-02-22T05:09:00.000
1
0
false
28,654,775
0
0
1
1
Hello everyone I am a grader for a programming language class and i am trying to use jenkins continuous integration for running some junit tests on their code that is pushed to github. I was able to get all the committed jobs to the jenkins, but can i run a python file in order to push a testing class to their code and...
Is it possible to write on s3 key using boto?
28,658,712
1
0
210
0
python,amazon-s3,boto,librsync
There is no way to append to or modify an existing object in S3. You can overwrite it completely with new content and you can have versioning enabled on the bucket so the previous versions of the object are still accessible but modifying an existing object is just not supported by the S3 service or API.
0
0
0
0
2015-02-22T07:31:00.000
1
0.197375
false
28,655,576
0
0
1
1
I have an app built with boto that sync files locally using librsync(wrapped in a python module). I was wondering if is it possible to write on S3 keys so that I could use librsync remotely, for example I would sync a local file with a file in S3 by taking signatures,delta and patch the result. In the boto documentatio...
Is it (un)safe to let users edit email Django templates in your app for emails?
28,676,062
0
3
183
0
python,django,email,templates
I believe there are many answers on here already regarding this; but to summarize what I've found: It is "safe" to do so, but take care what variables/objects you expose to the user (i.e. include in the context of the template to be rendered). render_to_string('template_name.txt', {'user': Users}) would be really bad :...
0
0
0
0
2015-02-23T14:12:00.000
2
1.2
true
28,675,722
0
0
1
2
I'm creating an small SaaS app in Django. It gathers data from webservers from different organizations. Once in a while it automatically needs to send out notification mails to their customers (domain owners). I would like to let our users (the webhosters) to change the email templates to their likings/needs, before se...
Is it (un)safe to let users edit email Django templates in your app for emails?
28,676,356
-1
3
183
0
python,django,email,templates
It all depends on the context in which the template will be evaluated, just make sure that no variable is passed that should be considered private. Also, should a security bug be discovered in Django templating system, your web application would be at risk. You would have to validate the input, but you can't really do ...
0
0
0
0
2015-02-23T14:12:00.000
2
-0.099668
false
28,675,722
0
0
1
2
I'm creating an small SaaS app in Django. It gathers data from webservers from different organizations. Once in a while it automatically needs to send out notification mails to their customers (domain owners). I would like to let our users (the webhosters) to change the email templates to their likings/needs, before se...
Nodejs Server, get JSON data from Python in html client with Ajax
28,687,176
0
1
932
0
python,ajax,json,node.js
In your application, if you have some requirement of processing results of python server requests in your nodejs application, then you need to call the python server requests in nodejs app with request libray and then process the result. Otherwise, you should simply call python server resources through client side ajax...
0
0
1
0
2015-02-23T17:06:00.000
2
0
false
28,679,250
0
0
1
1
I need to get data (json) in my html page, with help of Ajax. I have a Nodejs server serving requests. I have to get the json from server, which is python code to process and produce json as output. So should i save json in db and access it? (seems complicated just for one single use) Should i run python server, to ...
"Unknown command syncdb" running "python manage.py syncdb"
35,020,640
8
32
73,141
1
django,sqlite,python-3.x,django-1.9
the new django 1.9 has removed "syncdb", run "python manage.py migrate", if you are trying to create a super user, run "python manage.py createsuperuser"
0
0
0
0
2015-02-24T00:01:00.000
10
1
false
28,685,931
0
0
1
6
I want to create the tables of one database called "database1.sqlite", so I run the command: python manage.py syncdb but when I execute the command I receive the following error: Unknown command: 'syncdb' Type 'manage.py help' for usage. But when I run manage.py help I don`t see any command suspicious to sub...
"Unknown command syncdb" running "python manage.py syncdb"
34,814,438
0
32
73,141
1
django,sqlite,python-3.x,django-1.9
You can run the command from the project folder as: "python.exe manage.py migrate", from a commandline or in a batch-file. You could also downgrade Django to an older version (before 1.9) if you really need syncdb. For people trying to run Syncdb from Visual Studio 2015: The option syncdb was removed from Django 1.9 (d...
0
0
0
0
2015-02-24T00:01:00.000
10
0
false
28,685,931
0
0
1
6
I want to create the tables of one database called "database1.sqlite", so I run the command: python manage.py syncdb but when I execute the command I receive the following error: Unknown command: 'syncdb' Type 'manage.py help' for usage. But when I run manage.py help I don`t see any command suspicious to sub...
"Unknown command syncdb" running "python manage.py syncdb"
36,004,441
0
32
73,141
1
django,sqlite,python-3.x,django-1.9
Run the command python manage.py makemigratons,and than python manage.py migrate to sync.
0
0
0
0
2015-02-24T00:01:00.000
10
0
false
28,685,931
0
0
1
6
I want to create the tables of one database called "database1.sqlite", so I run the command: python manage.py syncdb but when I execute the command I receive the following error: Unknown command: 'syncdb' Type 'manage.py help' for usage. But when I run manage.py help I don`t see any command suspicious to sub...
"Unknown command syncdb" running "python manage.py syncdb"
42,688,208
1
32
73,141
1
django,sqlite,python-3.x,django-1.9
Django has removed python manage.py syncdb command now you can simply use python manage.py makemigrations followed bypython manage.py migrate. The database will sync automatically.
0
0
0
0
2015-02-24T00:01:00.000
10
0.019997
false
28,685,931
0
0
1
6
I want to create the tables of one database called "database1.sqlite", so I run the command: python manage.py syncdb but when I execute the command I receive the following error: Unknown command: 'syncdb' Type 'manage.py help' for usage. But when I run manage.py help I don`t see any command suspicious to sub...
"Unknown command syncdb" running "python manage.py syncdb"
42,795,652
2
32
73,141
1
django,sqlite,python-3.x,django-1.9
In Django 1.9 onwards syncdb command is removed. So instead of use that one, you can use migrate command,eg: python manage.py migrate.Then you can run your server by python manage.py runserver command.
0
0
0
0
2015-02-24T00:01:00.000
10
0.039979
false
28,685,931
0
0
1
6
I want to create the tables of one database called "database1.sqlite", so I run the command: python manage.py syncdb but when I execute the command I receive the following error: Unknown command: 'syncdb' Type 'manage.py help' for usage. But when I run manage.py help I don`t see any command suspicious to sub...
"Unknown command syncdb" running "python manage.py syncdb"
43,525,717
0
32
73,141
1
django,sqlite,python-3.x,django-1.9
Alternarte Way: Uninstall Django Module from environment Edit Requirements.txt a type Django<1.9 Run Install from Requirments option in the enviroment Try Syncdb again This worked for me.
0
0
0
0
2015-02-24T00:01:00.000
10
0
false
28,685,931
0
0
1
6
I want to create the tables of one database called "database1.sqlite", so I run the command: python manage.py syncdb but when I execute the command I receive the following error: Unknown command: 'syncdb' Type 'manage.py help' for usage. But when I run manage.py help I don`t see any command suspicious to sub...
does the function in a python program written using sched, impact/block the the other functionality in the program?
29,127,707
0
0
39
0
python,module,scheduler
For now, changed the function call for the tidy up feature, by using the background scheduler implementation of the APScheduler module of python. This does not impact the function for serving http requests and has currently solved my problem
0
0
0
0
2015-02-24T15:20:00.000
1
1.2
true
28,699,580
0
0
1
1
I am new to the programming world and trying out something with Python. My requirement is to have http web server(built using BaseHTTPServer) that runs forever, which takes an input binary file through HTML form based on user selection and returns a set of HTML files back on the web client. As part of this when the use...
Checking username availability - Handling of AJAX requests (Google App Engine)
28,702,936
2
1
170
0
python,ajax,google-app-engine,memcached,google-cloud-datastore
I would recommend the blur event of the username field, combined with some sort of inline error/warning display. I would also suggest maintaining a memcache of registered usernames, to reduce DB hits and improve user experience - although probably not populate this with a warm-up, but instead only when requests are mad...
0
0
0
0
2015-02-24T17:31:00.000
2
0.197375
false
28,702,423
0
0
1
1
I want to add the 'check username available' functionality on my signup page using AJAX. I have few doubts about the way I should implement it. With which event should I register my AJAX requests? We can send the requests when user focus out of the 'username' input field (blur event) or as he types (keyup event). Whic...
BrowserMob only partially loading page on initial load; fine afterwards
29,100,263
1
1
90
0
python-2.7,selenium-webdriver,browsermob
When you configure the WebDriver in your test code, set the proxy address not as localhost:8080 but as 127.0.0.1:8080. I think that Firefox has some problems resolving the proxy localhost:8080 that it does not have with the explicit form 127.0.0.1:8080.
0
0
1
0
2015-02-24T19:24:00.000
1
0.197375
false
28,704,465
0
0
1
1
I'm trying to use BrowserMob to proxy pages with Selenium WebDriver. When the initial page request is made, many elements of the page fail to load (e.g., css, jquery includes). If I manually refresh the page everything loads as expected. Has anyone else seen this behavior? Is there a solution? Thanks!
For submiting HTML form data should I use the variable, "id", or "name"
28,707,296
2
1
39
0
python,html,forms,python-3.x
You should use the "name" attribute. For example using radio buttons, each button will have the same name but different Id. When submitted only the one with a value (the selected one) will be submitted.
0
0
0
0
2015-02-24T22:03:00.000
1
1.2
true
28,707,240
1
0
1
1
I am trying to submit a form via python and I need to know, should I use the "id" value, or the "name" value. They are both different.
Bokeh Server Files: load_from_config = False
28,711,218
0
0
132
0
python,python-2.7,bokeh
These files are to store data and plots persistently on a bokeh-server, for instance if you want to publish a plot so that it will always be available. If you are just using the server locally and always want a "clean slate" you can run with --backend=memory to use the in-memory data store for Bokeh objects.
0
0
0
0
2015-02-25T00:15:00.000
1
0
false
28,708,890
0
0
1
1
on Bokeh 0.7.1 I've noticed that when I run the bokeh-server, files appear in the directory that look like bokeh.data, bokeh.server, and bokeh.sets, if I use the default backend, or redis.db if I'm using redis. I'd like to run my server from a clean start each time, because I've found that if the files exist, over tim...
Can I use a port-redirect in Apache as a security layer?
28,710,800
1
0
74
0
apache,security,ipython
The apache proxy seems a viable solution (if that meets your needs for login security). You could probably use iptables to do a port forward from that server port (using localhost probably?) to port 80 on apache. This way nobody will be able to access it directly.
0
0
0
0
2015-02-25T03:33:00.000
1
0.197375
false
28,710,649
0
0
1
1
I'm not an expert web app developer. I have an IPython Notebook server running on some port. The in-built security is not great -- one global password can be set, no support for multiple users or for integrating with (e.g.) active directory or OpenID. I believe I can use an Apache port redirect to control access. e.g. ...
Python bottle: iterate through folder in app's route or in template?
28,722,748
1
1
105
0
python,bottle
In general, a best practice is to do the work in the app, and do (only) presentation in the template. This keeps your so-called business logic as separate as possible from your rendering. Even if it wasn't a bad idea, I don't even know how you could walk through a directory of files from within a template. The subset...
0
1
0
0
2015-02-25T08:17:00.000
1
0.197375
false
28,714,197
0
0
1
1
I'm beginning to work on a Python 3.4 app to serve a little website (mostly media galleries) with the bottle framework. I'm using bottle's 'simple template engine' I have a YAML file pointing to a folder which contains images and other YAML files (with metadata for videos). The app or the template should then grab all ...
Share choices across Django apps
28,719,139
0
5
1,335
0
python,django
this problem has several solutions: put your choices on the settings file and get these values in apps. set CONSTANT in determine app or model and access choices by onwer name set choices items by one-to-many and you then can access choices by model ... also you can mix these ways :)
0
0
0
0
2015-02-25T12:27:00.000
3
0
false
28,719,031
0
0
1
2
In my models I'm using the choices option in some of my fields. But I'm using the same choices in multiple apps in my Django project. Where should I place my choices and how can I load these choices in all my apps?
Share choices across Django apps
28,719,284
4
5
1,335
0
python,django
We usually have quite a few project-specific apps per project here, and to try and keep dependencies reasonably clean we usually have two more apps: "core" in which we put things shared by other apps (any app can depend on "core", "core" doesn't depend on any app), and "main" in which tie things together ("main" can ...
0
0
0
0
2015-02-25T12:27:00.000
3
0.26052
false
28,719,031
0
0
1
2
In my models I'm using the choices option in some of my fields. But I'm using the same choices in multiple apps in my Django project. Where should I place my choices and how can I load these choices in all my apps?
Better logs and tracking bottlenecks in heroku
28,755,134
1
0
40
0
python,django,logging,heroku
The best tool I found is newrelic.com It hooks nicely into django apps and heroku. It can even show you the bottlenecks due to queries and functions inside your views.
0
0
0
0
2015-02-25T18:24:00.000
1
1.2
true
28,726,763
0
0
1
1
I have a backend server running on heroku. Right now for going through logs all I have been using is the 'heroku logs' command. I have been using that command also to track how long different requests to each endpoint are taking. Is there a better way to see a list of how long requests to different endpoints are taking...
Let website user access api flask
28,750,364
0
0
143
0
python,api,authentication,flask,flask-login
The way I ended up going was combining both approaches. user_logged_in fires whenever a user logs in. I used that method to generate an api-token and store it in the user object at login. Then, when the user wants to make an api call, the token is simply retrieved from the user object. I'm not sure if this is best pra...
0
0
0
0
2015-02-25T23:58:00.000
1
1.2
true
28,732,095
0
0
1
1
I have two web applications. One is a website. The other is an API. Both are built using flask. They use different methods of authentication. The website uses the flask-login library. Specifically, is uses login_user if user.check_password supplied by a form is true. The api uses a cryptographically signed token. The a...
Does Boto retry on failed md5 checks?
28,745,850
1
1
329
0
python,amazon-s3,boto
When boto uploads a file to S3 it calculates the MD5 checksum locally, sends that checksum to S3 as the Content-MD5 header and then checks the value of the ETag header returned by the S3 service against the previously computed MD5 checksum. If the ETag header does not match the MD5 it raises an S3DataError exception. ...
0
0
1
0
2015-02-26T01:06:00.000
1
1.2
true
28,732,751
0
0
1
1
The boto config has a num_retries parameter for uploads. num_retries The number of times to retry failed requests to an AWS server. If boto receives an error from AWS, it will attempt to recover and retry the request. The default number of retries is 5 but you can change the default with this option. My underst...
how to handle tcp connections on django
28,760,572
1
1
143
0
python,django
I would recommend using Celery processes in the background and perhaps use the awesome Twisted library for handling your network requirements.
0
0
0
0
2015-02-27T04:49:00.000
1
1.2
true
28,757,736
0
0
1
1
I have a django framework that receives user form. Thi input is used to create a TCP connection with a backhand process and send and receive json on it. How do I handle several TCP connections using django framework?
How to fetch data from a website using Python that is being populated by Javascript?
28,852,463
1
0
272
0
javascript,python,html,web-scraping,beautifulsoup
The Python binding for Selenium and phantomjs (if you want to use a headless browser as backend) are the appropriate tools for this job.
0
0
1
0
2015-02-27T12:42:00.000
2
0.099668
false
28,765,398
0
0
1
2
I want to fetch few data/values from a website. I have used beautifulsoup for this and the fields are blank when I try to fetch them from my Python script, whereas when I am inspecting elements of the webpage I can clearly see the values are available in the table row data. When i saw the HTML Source I noticed its bla...
How to fetch data from a website using Python that is being populated by Javascript?
28,850,142
0
0
272
0
javascript,python,html,web-scraping,beautifulsoup
Yes, you can scrape JS data, it just takes a bit more hacking. Anything a browser can do, python can do. If you're using firebug, look at the network tab to see from which particular request your data is coming from. In chrome element inspection, you can find this information in a tab named network, too. Just hit ctrl-...
0
0
1
0
2015-02-27T12:42:00.000
2
0
false
28,765,398
0
0
1
2
I want to fetch few data/values from a website. I have used beautifulsoup for this and the fields are blank when I try to fetch them from my Python script, whereas when I am inspecting elements of the webpage I can clearly see the values are available in the table row data. When i saw the HTML Source I noticed its bla...
How to make a webpage display dynamic data in real time using Python?
28,787,299
0
1
6,330
0
python,html,css,python-3.x
To achieve your goal, you need good knowledge of javascript, the language for dynamic web pages. You should be familiar with dynamic web techniques, AJAX, DOM, JSON. So the main part is on the browser side. Practically any python web server fits. To "bridge the gap" the keyword is templates. There are quite a few for p...
0
0
0
0
2015-02-28T21:09:00.000
2
0
false
28,786,932
0
0
1
1
I am working on making a GUI front end for a Python program using HTML and CSS (sort of similar to how a router is configured using a web browser). The program assigns values given by the user to variables and performs calculations with those variables, outputting the results. I have a few snags to work out: How do I ...
Let the SQL engine do the constraint check or execute a query to check the constraint beforehand
28,787,981
1
1
61
1
python,mysql,sql
The latter one you need to do and handle in any case, thus I do not see there is much value in querying for duplicates, except to show the user information beforehand - e.g. report "This username has been taken already, please choose another" when the user is still filling in the form.
0
0
0
0
2015-02-28T22:40:00.000
2
0.099668
false
28,787,814
0
0
1
2
Python application, standard web app. If a particular request gets executed twice by error the second request will try to insert a row with an already existing primary key. What is the most sensible way to deal with it. a) Execute a query to check if the primary key already exists and do the checking and error handli...
Let the SQL engine do the constraint check or execute a query to check the constraint beforehand
28,788,000
2
1
61
1
python,mysql,sql
The best option is (b), from almost any perspective. As mentioned in a comment, there is a multi-threading issue. That means that option (a) doesn't even protect data integrity. And that is a primary reason why you want data integrity checks inside the database, not outside it. There are other reasons. Consider per...
0
0
0
0
2015-02-28T22:40:00.000
2
1.2
true
28,787,814
0
0
1
2
Python application, standard web app. If a particular request gets executed twice by error the second request will try to insert a row with an already existing primary key. What is the most sensible way to deal with it. a) Execute a query to check if the primary key already exists and do the checking and error handli...
How to share memcache items across 2 apps locally using google app eninge sdk
28,804,617
2
1
63
0
python,google-app-engine
Actually two different App Engine apps cannot see the same items in memcache. Their memcache spaces are totally isolated from each other. However two different modules of the same app use the same memcache space and can read and write the same items. Modules act like sub-apps. Is that what you meant? It is also possib...
0
1
0
0
2015-03-01T13:04:00.000
1
1.2
true
28,793,857
0
0
1
1
I have 2 Google App Engine applications which share memcache items, one app writes the items and the other apps reads them. This works in production. however - locally using the SDK, items written by one app are not available to the other. Is there a way to make this work?
Django get_signed_cookie on manually signed cookie
28,808,418
-1
2
820
0
python,django,cookies,django-rest-framework,django-testing
I have found my solution. It was rather straightforward actually. I tried to set my cookie on my request for the test, which made sense since the cookie should be sent in the request. A better way of testing it is to just GET a resource first (which sets te cookie, which would happen in a normal web-situation as well) ...
0
0
0
0
2015-03-01T19:32:00.000
1
1.2
true
28,798,079
0
0
1
1
I'm using get_signed_cookie in one of my views, and it works. The problem is in testing it, i'm manually signing my cookie in my test using Django's django.core.signing module with the same salt as my actual code (i'm using a salt that's in my settings). When i do non-automated tests, all is well. I've compared the coo...
Does django adminplus effects performance?
33,037,343
0
1
83
0
python,django,apache
The problem for slow response was with the custom views which did not have pagination. After implementing this feature, response became fast :)
0
0
0
0
2015-03-02T07:44:00.000
1
1.2
true
28,804,802
0
0
1
1
I have used django-adminplus to register custom views with django-filters in the admin site. This is slowing down the performance of my django project. I am using Apache as my http webserver as also my static file renderer as I 'HAVE' to do it so. I cannot use gninx nor gunicorn. The views render several 100k records. ...
API for fetching movie details from IMDB or similar sites?
28,812,266
0
0
1,396
0
python,django,movie,imdb
If you have a server which is frequently used, you could think about caching the information locally. I suppose it's very likely that most queries will be clustered around a reduced set of movies, so that would speed up your search.
0
0
0
0
2015-03-02T14:02:00.000
1
0
false
28,811,688
0
0
1
1
I've tried using OMDb, it gives all the things I need and has a very simple working too, but it is very very slow. I looped about 200 queries and it took about 3 minutes to complete. Is there any faster API out there that can give me similar results on querying an movie. The details i'm looking for in particular are ge...
HG - Find current running revision of a code file
28,817,753
0
0
119
0
python,django,mercurial
You can use hg id -i to see the currently checked out revision on your server, and hg status to check if the file has been modified relative to that revision.
0
0
0
1
2015-03-02T19:07:00.000
2
0
false
28,817,558
0
0
1
1
I'm using mercurial and I think I may have an older revision of a python file running on my server. How can I tell which revision, of a particular file, is currently being ran on in my web application? I suspect an older revision because I currently have an error being thrown in sentry that refers to a line of code th...
Using group by in DynamoDB
28,890,074
2
0
3,106
1
python,amazon-web-services,amazon-dynamodb,boto
You can create 2 GSIs: 1 with date as hashKey, 1 with month as hashKey. Those GSIs will point you to the rows of that month / of that day. Then you can just query the GSI, get all the rows of that month/day, and do the aggregation on your own. Does that work for you? Thanks! Erben
0
0
0
0
2015-03-02T19:56:00.000
1
1.2
true
28,818,394
0
0
1
1
For a project I have to use DynamoDB(aws) and python(with boto). I have items with a date and I need to display the count grouped by date or by month. Something like by date of the month [1/2: 5, 2/2: 10, 3/2: 7, 4/2: 30, 5/2: 25, ...] or by month of the year [January: 5, February: 10, March: 7, ...]
joining urls with urljoin in python
30,655,631
0
0
399
0
python,urllib,urlparse
Two dots (..) means go back once in the hierarchy, change the second link to ./v2/meila07a/meila07a.pdf and it should be working fine. Or you can also change the root one to http://www.jmlr.org/proceedings/papers/v2/, thanks to this change it will no longer dispose of v2 at the end because the root was not set to a pro...
0
0
1
0
2015-03-02T20:06:00.000
1
0
false
28,818,559
0
0
1
1
I am trying to do some web scraping but I have some problems in joining relative and root urls for example the root url is: http://www.jmlr.org/proceedings/papers/v2 and the relative url is: ../v2/meila07a/meila07a.pdf As I use urljoin in urlparse: the result is odd: http://www.jmlr.org/proceedings/v2/meila07a/meila07a...
Running aws-lambda function in a existing bucket with files
56,451,012
1
4
2,230
0
java,python,amazon-s3,thumbnails,aws-lambda
You can add a SQS queue as an event source/trigger for the Lambda, make the slight changes in the Lambda to correctly process a SQS event as opposed to a S3 event, and then using a local script loop through a list of all objects in the S3 bucket (with pagination given the 2MM files) and add them as messages into SQS. T...
0
0
0
1
2015-03-03T02:40:00.000
2
0.099668
false
28,823,172
0
0
1
1
I'm planning to migrate existing image processing logic to AWS lambda. Lambda thumbnail generator is better than my previous code so I want to re-process all the files in an existing bucket using lamdba. Lambda seems to be only event driven, this means that my lamdba function will only be called via a PUT event. Since ...
GAE blobstore upload fails with CSRF token missing
28,857,208
0
0
228
0
python,google-app-engine,flask,blobstore,flask-wtforms
Okey, so the real problem was that I was giving an absolute url to the successpath argument (i.e. the first) of blobstore.create_upload_url(), causing the request notifying about the success caused a csrf error when loading the root path (/). I changed it to a path relative to the root and now just using @csrf.exempt ...
0
1
0
0
2015-03-03T22:27:00.000
2
0
false
28,843,234
0
0
1
1
I'm running flask on app engine. I need to let users upload some files. For security reasons I have csrf = CsrfProtect(app) on the whole app, with specific url's exempted using the @csrf.exempt decorator in flask_wtf. (Better to implicitly deny than to implicitly allow.) Getting an upload url from blobstore with blobst...
Task queue: Allow only one task at a time per user
28,849,410
1
2
406
0
python,google-app-engine,task-queue
You can specify as many queues as you like in queue.yaml rather than just using the default push queue. If you feel that no more than, say, five users at once are likely to contest for simultaneous use of them then simply define five queues. Have a global counter that increases by one and wraps back to 1 when it exceed...
0
1
0
0
2015-03-04T07:27:00.000
1
0.197375
false
28,848,740
0
0
1
1
In my application, I need to allow only one task at a time per user. I have seen that we can set max_concurrent_requests: 1 in queue.yaml. but this will allows only one task at a time in a queue. When a user click a button, a task will be initiated and it will add 50 task to the queue. If 2 user click the button in alm...
how to generate custom 403 HTTP responses in Plone (prevent redirect)
28,862,411
0
1
172
0
python,plone
You could override Products/CMFPlone/skins/plone_login/require_login.py and add any logic that you want there to give a custom response. Or bypass require_login completely and use an own browser view to handle this. In your Plone Site go to acl_users/credentials_cookie_auth/manage_propertiesForm and for the Login Form...
0
0
0
0
2015-03-04T09:20:00.000
2
0
false
28,850,653
0
0
1
1
Upon unauthorized access, Plone by default provides a redirect to login form. I need to prevent this for certain subpaths (ie. not globally), and instead return 403 Forbidden, with a custom (short) HTML page, after the (otherwise) normal Plone authentication & authorization has taken place. I looked into ITraversable b...
Django Tests run faster with no internet connection
28,864,271
2
2
523
0
python,django,testing,python-unittest
This most likely means you've got some component installed which is trying to make network connections. Possibly something that does monitoring or statistics gathering? The simplest way to figure out what's going on is to use tcpdump to capture your network traffic and see what's going on. To do that: Run tcpdump -i a...
0
0
0
1
2015-03-04T20:22:00.000
1
1.2
true
28,864,152
0
0
1
1
I have a django test suite that builds a DB from a 400 line fixture file. It runs unfortunately slow. Several seconds per test. I was on the train yesterday developing without internet access, with my wifi turned off, and I noticed my tests ran literally 10x faster without internet. And they are definitely running cor...
Django keeps calling another package to paginate -- how?
28,939,075
0
0
36
0
python,django,pagination
You've all been really helpful. However the my confusion came from the fact that paginator was being added to the context, yet there was a statement {% load paginator %} at the top of the template. I thought they were the same, but no. The paginator from the context was unused, and the load statement pulled in the bad...
0
0
0
0
2015-03-05T12:05:00.000
2
1.2
true
28,877,499
0
0
1
1
My code imports Paginator from django.core.paginator. (Django 1.6.7) However, when run, somehow it is calling a custom paginator. I don't want it to do this, as the custom paginator template has been removed in an upgrade. I just want Django's Paginator to be used, but I can't find how to workout where it's overriding...
create input form for 540 fields in django. Best approach?
28,894,444
1
0
50
0
python,django,django-forms,django-formwizard
One approach that you could consider is splitting up your model into semantic slices, each one being a model on its own with a more digestable number of fields. Then map these "slice-models" back to your main object using a one-to-one relationship (implemented by OneToOneField). In your wizard you could start a transac...
0
0
0
0
2015-03-06T07:53:00.000
2
0.099668
false
28,894,339
0
0
1
1
I'm new to django and would like to hear your opinion on how to create a form for a table with 540 fields. What would be the best approach? Is it best to split the modelform into multiple components or create a template that collects the input in parts (multiple inputs per page) and proceeds through all fields? It woul...
How to create multiple entities dynamically in google app engine using google data storage(python)
29,608,781
1
0
165
0
python,google-app-engine,google-cloud-datastore
It's not recommended to dynamically create a new table. You need to redesign your database relation structure. For example in a user messaging app instead of making a new table for every new message [ which contains message and user name] , you should rather create a User table and Messagestable separately and impleme...
0
1
0
0
2015-03-06T12:29:00.000
1
1.2
true
28,898,827
0
0
1
1
I wish to implement this: There should be an entity A with column 1 having values a,b,c...[dynamically increases by user's input] There should be another entity B for each values of a , b , c.. How should I approach this problem? Should I dynamically generate other entities as user creates more [a,b,c,d... ] ? If yes ...
What can go wrong if I use SimpleCache in my Flask app
50,258,834
1
8
3,322
0
python,python-2.7,caching,flask,gunicorn
For your use case with gunicorn, there is no multi-threading issue since each service run single-threadedly in its own process. But a potential problem would be "dirty" read of the data. Think about the following case: process1 read from db and populate its own cache, cache1 process2 read from the same table using the...
0
0
0
0
2015-03-06T13:43:00.000
2
0.099668
false
28,900,091
0
0
1
1
We are using the following setup: NGINX+Gunicorn+Flask. We need to add just a little bit of caching, no more than 5Mb per Flask worker. SimpleCache seems to be simplest possible solution - it uses memory locally, inside the Python process itself. Unfortunately, the documentation states the following: "Simple memory ...
Django REST Backend for mobile app with Facebook login
38,586,945
0
1
779
0
django,facebook,rest,django-rest-framework,python-social-auth
i didn't unerstand the first case, when you are using facebook login it does the authentication and we will register the user with the access token provided by facebook. When ever user log in we are not worried about the password, authentication is not done on our end. so when ever user tries to login it contacts faceb...
0
0
0
0
2015-03-06T16:28:00.000
1
0
false
28,903,187
0
0
1
1
I have to implement a REST backend for mobile applications. I will have to use Django REST Framework. Among the features that I need to implement there will be the registration user and login. Through the mobile application the user can create an account using ONLY the Facebook login. Then, the application will take t...