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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
What is the difference between Django and Python? | 17,052,782 | 6 | 5 | 9,241 | 0 | python,django | Python is a programming language. Django is a web framework built using Python, designed to simplify the creation of websites. It provides a set of common functionality to reduce the amount of trivial code that you need to write.
Django provides:
An administration panel
A database modeling layer
A templating system
Fo... | 0 | 0 | 0 | 0 | 2013-06-11T20:02:00.000 | 2 | 1 | false | 17,052,725 | 1 | 0 | 1 | 1 | I'm looking at a job possibility that has a need for both Django and Python. I have some experience with Python but none with Django, nor do I know precisely what Django is. Can someone please explain the difference between Django and Python, how they are related and what they are used for?
Thanks in advance for all yo... |
Google App Engine Launcher not starting | 17,086,966 | 1 | 1 | 291 | 0 | python,windows,google-app-engine | I was having same problem with google app engine 1.8.0 then i installed the latest 1.8.1 and the issue fixed! | 0 | 1 | 0 | 0 | 2013-06-13T04:38:00.000 | 1 | 0.197375 | false | 17,079,358 | 0 | 0 | 1 | 1 | I'm install google app engine on my laptop and when i clicked on google app engine launcher icon, mouse change to loading icon then nothing run, nothing display and no error reported, just nothing.
My laptop running with WIN7 64bit, Python27 installed.
Please help. |
django 1.5 update ALLOWED_HOSTS failing SuspiciousOperation | 17,105,379 | 0 | 5 | 4,184 | 0 | python,django,django-1.5 | Resolved. I had deploy settings in a different file overriding the allowed_hosts in settings.py. Appologies missed this before posting. Thanks for the responses received. | 0 | 0 | 0 | 0 | 2013-06-13T17:00:00.000 | 1 | 0 | false | 17,092,893 | 0 | 0 | 1 | 1 | I have updated to django 1.5 and am getting the following message:
SuspiciousOperation: Invalid HTTP_HOST header (you may need to set ALLOWED_HOSTS): localhost:8000
I have tried localhost, 127.0.0.1, localhost:8000 in ALLOWED_HOSTS. I have also tried ['*'] all without success.
Anybody any ideas where I am going wrong... |
Get raw query string in flask | 21,792,010 | 5 | 6 | 4,634 | 0 | python,flask,query-string | request.query_string also seems to work. | 0 | 0 | 0 | 0 | 2013-06-13T17:27:00.000 | 2 | 0.462117 | false | 17,093,372 | 0 | 0 | 1 | 1 | Is there a way to get the raw query string or a list of query string parameters in Flask?
I know how to get query string parameters with request.args.get('key'), but I would like to be able to take in variable query strings and process them myself. Is this possible? |
how to access my 127.0.0.1:8000 from android tablet | 17,116,746 | 1 | 31 | 33,438 | 0 | android,python,django,web,localhost | If both are connected to the same network, all you need to do is provide the IP address of your server (in your network) in your Android app. | 0 | 1 | 0 | 0 | 2013-06-14T20:24:00.000 | 9 | 0.022219 | false | 17,116,718 | 0 | 0 | 1 | 6 | I am developing a webpage in django (on my pc with windows 7) and now i need to test some pages in tablet pcs. suddenly the thought came if i can have an access to my localhost in windows from android tablet. is that possible? I am in the same wifi connection in both devices at home.
i read a lot questions and answers... |
how to access my 127.0.0.1:8000 from android tablet | 61,816,349 | 0 | 31 | 33,438 | 0 | android,python,django,web,localhost | Try this
python manage.py runserver
then connect both tablet and system to same wifi and browse in the address
eg: python manage.py runserver 192.168.0.100:8000
In tablet type that url in adress bar | 0 | 1 | 0 | 0 | 2013-06-14T20:24:00.000 | 9 | 0 | false | 17,116,718 | 0 | 0 | 1 | 6 | I am developing a webpage in django (on my pc with windows 7) and now i need to test some pages in tablet pcs. suddenly the thought came if i can have an access to my localhost in windows from android tablet. is that possible? I am in the same wifi connection in both devices at home.
i read a lot questions and answers... |
how to access my 127.0.0.1:8000 from android tablet | 17,116,796 | 1 | 31 | 33,438 | 0 | android,python,django,web,localhost | need to know the ip address of your machine ..
Make sure both of your machines (tablet and computer) connected to same network
192.168.0.22 - say your machine address
do this :
192.168.0.22:8000 -- from your tablet
this is it !!! | 0 | 1 | 0 | 0 | 2013-06-14T20:24:00.000 | 9 | 0.022219 | false | 17,116,718 | 0 | 0 | 1 | 6 | I am developing a webpage in django (on my pc with windows 7) and now i need to test some pages in tablet pcs. suddenly the thought came if i can have an access to my localhost in windows from android tablet. is that possible? I am in the same wifi connection in both devices at home.
i read a lot questions and answers... |
how to access my 127.0.0.1:8000 from android tablet | 17,116,791 | 16 | 31 | 33,438 | 0 | android,python,django,web,localhost | You can find out what the ip address of your PC is with the ipconfig command in a Windows command prompt. Since you mentioned them being connected over WiFi look for the IP address of the wireless adapter.
Since the tablet is also in this same WiFi network, you can just type that address into your tablet's browser, wi... | 0 | 1 | 0 | 0 | 2013-06-14T20:24:00.000 | 9 | 1.2 | true | 17,116,718 | 0 | 0 | 1 | 6 | I am developing a webpage in django (on my pc with windows 7) and now i need to test some pages in tablet pcs. suddenly the thought came if i can have an access to my localhost in windows from android tablet. is that possible? I am in the same wifi connection in both devices at home.
i read a lot questions and answers... |
how to access my 127.0.0.1:8000 from android tablet | 17,116,785 | 6 | 31 | 33,438 | 0 | android,python,django,web,localhost | 127.0.0.1 is a loopback address that means, roughly, "this device"; your PC and your android tablet are separate devices, so each of them has its own 127.0.0.1. In other words, if you try to go to 127.0.0.1 on your Android tab, it's trying to connect to a webserver on the Android device, which is not what you want.
Ho... | 0 | 1 | 0 | 0 | 2013-06-14T20:24:00.000 | 9 | 1 | false | 17,116,718 | 0 | 0 | 1 | 6 | I am developing a webpage in django (on my pc with windows 7) and now i need to test some pages in tablet pcs. suddenly the thought came if i can have an access to my localhost in windows from android tablet. is that possible? I am in the same wifi connection in both devices at home.
i read a lot questions and answers... |
how to access my 127.0.0.1:8000 from android tablet | 48,594,665 | 23 | 31 | 33,438 | 0 | android,python,django,web,localhost | Though this thread was active quite a long time ago. This is what worked for me on windows 10. Posting it in details. Might be helpful for the newbies like me.
Add ALLOWED_HOSTS = ['*'] in django settings.py file
run django server with python manage.py 0.0.0.0:YOUR_PORT. I used 9595 as my port.
Make firewall to allo... | 0 | 1 | 0 | 0 | 2013-06-14T20:24:00.000 | 9 | 1 | false | 17,116,718 | 0 | 0 | 1 | 6 | I am developing a webpage in django (on my pc with windows 7) and now i need to test some pages in tablet pcs. suddenly the thought came if i can have an access to my localhost in windows from android tablet. is that possible? I am in the same wifi connection in both devices at home.
i read a lot questions and answers... |
Embedding a TinyMCE editor in PyQT QWebkit | 17,288,641 | 0 | 0 | 239 | 0 | javascript,python,tinymce,pyqt,qwebkit | EvaluateJavaScript does make javascript function calls, or embed a whole javascript file. The following details out the attempts to solve the problem:
The approach of first reading the tinyMCE.js file and then using that in an evaluatejavascript method embeds the javascript somewhere, and can't be sniffed out in a web... | 1 | 0 | 0 | 0 | 2013-06-15T01:29:00.000 | 1 | 0 | false | 17,119,388 | 0 | 0 | 1 | 1 | as the question states, I wish to embed a tinymce editor in a PyQT webkit component.
As far as I understand, evaluateJavascript allows for js functions to be called.
However, when I try loading tinymce.min.js, the editor does not display anything at all. As suspected, when evaluating a javascript that 'loads' other jav... |
Python Request Module - Google App Engine | 35,530,496 | 0 | 4 | 4,323 | 0 | python,google-app-engine | You need to add the requests/requests sub-folder to your project. From your script's location (.), you should see a file at ./requests/__init__.py.
This applies to all modules you include for Google App Engine. If it doesn't have a __init__.py directly under that location, it will not work.
You do not need to add the m... | 0 | 1 | 0 | 0 | 2013-06-15T21:36:00.000 | 2 | 0 | false | 17,128,130 | 0 | 0 | 1 | 1 | I'm trying to import the requests module for my app which I want to view locally on Google App Engine. I am getting a log console error telling me that "no such module exists".
I've installed it in the command line (using pip) and even tried to install it in my project directory. When I do that the shell tells me:
"Re... |
South skip broken migrations | 17,128,801 | 0 | 2 | 1,534 | 0 | python,django,django-south | I usually make a temporary modification to the migration script that fails. Comment out or modify the parts that are not needed, run the migrations, then restore everything to the way it was before.
It's not ideal, and it involves some duplication of work - you have to do the same steps both on dev machine and on the ... | 0 | 0 | 0 | 0 | 2013-06-15T23:07:00.000 | 2 | 0 | false | 17,128,740 | 0 | 0 | 1 | 1 | I am using a 3rd party app inside my django application and the older versions of it had a dependancy on the django auth model, but the newer version supports the custom auth model of django 1.5.
The problem I am having is that when I install the app and migrate app, it breaks on the migration 002 because it is refere... |
Simultanous AJAX requests and MySQL database data visibility in Django | 17,132,550 | 0 | 0 | 323 | 0 | python,mysql,database,django | I have solved this issue by wrapping my view in the @transaction.autocommit decorator and executing transaction.commit() immediately before checking in the database if an answer with a particular client_id exists. This accomplishes the "refresh" I was aiming for. | 0 | 0 | 0 | 0 | 2013-06-16T10:30:00.000 | 1 | 0 | false | 17,132,334 | 0 | 0 | 1 | 1 | I have a Django app with a MySQL database which allows answering of questions on an HTML page. The answers get sent to the server via AJAX calls. These calls are initiated by various JavaScript events and can often be fired multiple times for one answer. When this happens, multiple save requests for one answer get sent... |
Trying to understand Python and all its moving parts - What is the difference between Tkinter and Django | 17,137,094 | 3 | 0 | 2,632 | 0 | python,django,model-view-controller,event-handling,tkinter | Tkinter is a GUI library (for desktop applications) and Django is for web development. Both are completely different and in fact it is useless to compare them even. | 1 | 0 | 0 | 0 | 2013-06-16T19:49:00.000 | 2 | 0.291313 | false | 17,137,050 | 0 | 0 | 1 | 1 | I have a school project where my team needs to build a board game. We want to use Python based on all the good things we have heard. I have been researching MVC frameworks and came across Django (its part of my installation on Pydev). I have a Mac, fyi.
I have also been looking up Tkinter but cant seem to understand w... |
How to get PyCharm to check PEP8 code style? | 58,257,720 | 1 | 30 | 58,662 | 0 | python,pycharm | Well, I wish I had a better answer, but what helped me was simply the following:
switch the interpreter from a remote one to a system one
wait until the Pycharm indexing is done
switch the interpreter back to the initial/desired one | 0 | 0 | 0 | 0 | 2013-06-17T02:00:00.000 | 5 | 0.039979 | false | 17,139,485 | 1 | 0 | 1 | 2 | I'm using PyCharm (v 2.7.2) to develop a Django app, but I can't get it to check PEP8 style violations.
I have enabled "PEP8 coding style violation" in the "Inspctions" section of the settings, but PyCharm doesn't highlight the style violations.
Is there a way to fix this? |
How to get PyCharm to check PEP8 code style? | 34,655,470 | 13 | 30 | 58,662 | 0 | python,pycharm | Mine wasn't showing up due to the color scheme. By default it's marked as "weak warning", so you might have to edit the appearance to make it visible. Editor > Colors & Fonts > General > Errors and Warnings. | 0 | 0 | 0 | 0 | 2013-06-17T02:00:00.000 | 5 | 1 | false | 17,139,485 | 1 | 0 | 1 | 2 | I'm using PyCharm (v 2.7.2) to develop a Django app, but I can't get it to check PEP8 style violations.
I have enabled "PEP8 coding style violation" in the "Inspctions" section of the settings, but PyCharm doesn't highlight the style violations.
Is there a way to fix this? |
Forms between Django Client and Django Piston API | 17,200,127 | 0 | 0 | 75 | 0 | python,django,rest,django-forms,django-piston | Use Django Tastypie, it's a much more robust REST framework than Piston :) | 0 | 0 | 0 | 0 | 2013-06-17T05:15:00.000 | 1 | 0 | false | 17,140,809 | 0 | 0 | 1 | 1 | Is there any easy way to process the ModalForm in Django Piston API to a Django Client? ,
On documentations @validate decorator is mentioning but I couldn't find the way to send forms from API to the Django Client. I feel like it is possible to use Django Forms from API like in local on Client side. |
How can I serve arbitrary request paths? | 17,305,631 | 0 | 1 | 47 | 0 | python,zope | There are two adapters needed for this. One adapts the ZODB context one wishes to use and zope.publisher.interfaces.IRequest, while providing zope.traversing.interfaces.ITraversable (view). The second adapts the previous objects instantiated view and zope.publisher.interfaces.browser.IBrowserRequest, while providing zo... | 0 | 0 | 1 | 0 | 2013-06-17T15:50:00.000 | 1 | 0 | false | 17,151,693 | 0 | 0 | 1 | 1 | How can I serve arbitrary paths zope.browserrsource does for @@ and ++resource++ URIs in Zope? |
Exception Handling guideline- Python vs Java | 17,158,594 | 2 | 9 | 2,973 | 0 | java,python,exception-handling | OK, I can try and give an answer which I'll keep as neutral as it can be... (note: I have done Python professionally for a few months, but I am far from mastering the language in its entirety)
The guidelines are "free"; if you come from a Java background, you will certainly spend more time than most Python devs out th... | 0 | 0 | 0 | 0 | 2013-06-17T23:01:00.000 | 3 | 1.2 | true | 17,158,233 | 1 | 0 | 1 | 2 | I am original Java developer, for me, checked Exception in Java is obviously/easy enough for me to decide to catch or throw it to the caller to handle later. Then it comes Python, there is no checked exception, so conceptually, nothing forces you to handle anything(In my experience, you don't even know what exceptions ... |
Exception Handling guideline- Python vs Java | 17,158,373 | -3 | 9 | 2,973 | 0 | java,python,exception-handling | Best practice is to handle appropriate exceptions in the appropriate place. Only you, as developer, can decide which part of your code should catch exceptions. This should become apparent with decent unit testing. If you have unhandled exceptions, they will show up.
You already described the differences. At a more fun... | 0 | 0 | 0 | 0 | 2013-06-17T23:01:00.000 | 3 | -0.197375 | false | 17,158,233 | 1 | 0 | 1 | 2 | I am original Java developer, for me, checked Exception in Java is obviously/easy enough for me to decide to catch or throw it to the caller to handle later. Then it comes Python, there is no checked exception, so conceptually, nothing forces you to handle anything(In my experience, you don't even know what exceptions ... |
Is there any simple way to store the user location while registering in database | 17,159,679 | 0 | 0 | 163 | 1 | python,django,ip | Not in any reliable way, or at least not in Django. The problem is that user IPs are usually dynamic, hence the address is changing every couple of days. Also some ISPs soon will start to use a single IP for big blocks of users (forgot what this is called) since they are running out of IPv4 IP addresses... In other wor... | 0 | 0 | 0 | 0 | 2013-06-18T02:12:00.000 | 4 | 0 | false | 17,159,576 | 0 | 0 | 1 | 1 | I have the user registration form made in django.
I want to know the city from which the user is registering.
Is there any way that i get the IP address of the user and then somehow get the city for that IP. using some API or something |
Is there a onSessionClose in WampServerProtocol? | 17,166,189 | 1 | 1 | 156 | 0 | python,autobahn | There is no WAMP specific session close (since WAMP does not have a closing handshake separate from WebSocket). You can use the onClose hook.
Another point you might have a look at: the recommended way of accessing databases from Twisted applications is via twisted.enterprise.adbapi which automatically manages a databa... | 0 | 1 | 0 | 0 | 2013-06-18T04:54:00.000 | 1 | 1.2 | true | 17,160,797 | 0 | 0 | 1 | 1 | I'm using Autobahn Python to make a WAMP server. I open up a database connection in onSessionOpen of my subclass of WampServerProtocol, and of course need to close it when the connection closed. However, I can't find a session close handler in either the tutorials or the docs. |
Running a Celery worker in unittest | 18,316,377 | 1 | 6 | 774 | 0 | python,unit-testing,integration-testing,celery | I'm not sure if it's worthwhile to explicitly test the transportation mechanism (i.e. the sending of the task parameters through celery) using a unit test. Personally, I would write my test as follows (can be split up in several unit tests):
Use the code from project B to generate a task with sample parameters.
Encode... | 0 | 1 | 0 | 1 | 2013-06-19T02:20:00.000 | 1 | 0.197375 | false | 17,181,923 | 0 | 0 | 1 | 1 | I have the following setup:
Django-Celery project A registers task foo
Project B: Uses Celery's send_task to call foo
Project A and project B have the same configuration: SQS, msgpack
for serialization, gzip, etc.
Each project lives on a different github repository
I've unit-tested calls to "foo" in project A, wi... |
Unable to locate the element while using selenium-webdriver | 17,183,255 | 0 | 0 | 157 | 0 | python,selenium-webdriver | Most of the times im using By.xpath and it works specially if you use contains in your xpath. For example : //*[contains(text(),'ABC')]
This will look for all the elements that contains string 'ABC'
In your case you can replace ABC with Delete Log File | 0 | 0 | 1 | 0 | 2013-06-19T04:49:00.000 | 2 | 0 | false | 17,183,068 | 0 | 0 | 1 | 1 | I am very much new to selenium WebDriver and I am trying to automate a page which has a button named "Delete Log File". Using FireBug I got to know that, the HTML is described as
and also the css selector is defined as "#DeleteLogButton" using firepath
hence I used
browser.find_element_by_css_selector("#DeleteLogBut... |
Languages compiling/interpreting to Javascript (such as Ruby/Python/Coffescript) | 17,195,327 | 0 | 0 | 192 | 0 | javascript,python,ruby,node.js,opalrb | You shouldn't even need to understand the syntax of Javascript. Just an understanding of the DOM should suffice. Having said that, all the DOM examples will be in JS syntax, so reading them will be tricky. Being able to debug the transpiled javascript is also usefulo
Correct. You can write a server an client with javas... | 0 | 0 | 0 | 0 | 2013-06-19T15:20:00.000 | 1 | 1.2 | true | 17,195,096 | 1 | 0 | 1 | 1 | Newbie self-learner diving into web development here. My goal is to learn how to build web-apps. Three quick questions:
Ruby and Python seem to have offshoots that compile their respective code to Javascript (i.e. Opal/Pyjamas). If I can get an understanding of the DOM, i.e. the DOM, do I have to even learn the f... |
Scrapy reversed item ordening for preparing in db | 17,213,740 | 0 | 2 | 201 | 1 | python,scrapy | Items in a database are have not a special order if you don't impose it. So you should add a timestamp to your table in the database, keep it up-to-date (mysql has a special flag to mark a field as auto-now) and use ORDER BY in your queries. | 0 | 0 | 0 | 0 | 2013-06-20T12:20:00.000 | 3 | 1.2 | true | 17,213,515 | 0 | 0 | 1 | 2 | I am trying to put the items, scraped by my spider, in a mysql db via a mysql pipeline. Everything is working but i see some odd behaviour. I see that the filling of the database is not in the same order as the website itself. There is like a random order. Probably of the dictionary like list of the items scraped i gue... |
Scrapy reversed item ordening for preparing in db | 17,221,923 | 1 | 2 | 201 | 1 | python,scrapy | It's hard to say without the actual code, but in theory..
Scrapy is completely async, you cannot know the order of items that will be parsed and processed through the pipeline.
But, you can control the behavior by "marking" each item with priority key. Add a field priority to your Item class, in the parse_item method o... | 0 | 0 | 0 | 0 | 2013-06-20T12:20:00.000 | 3 | 0.066568 | false | 17,213,515 | 0 | 0 | 1 | 2 | I am trying to put the items, scraped by my spider, in a mysql db via a mysql pipeline. Everything is working but i see some odd behaviour. I see that the filling of the database is not in the same order as the website itself. There is like a random order. Probably of the dictionary like list of the items scraped i gue... |
API to access a user's download history in Google Play? | 17,216,777 | 0 | 1 | 199 | 0 | android,python,django | That is not possible, as the history of google play only belongs to that particular app.
App to app communication is not possible to take data, unless using a content provider.
As every app is treated as a seperate user by the linux kernel. | 0 | 0 | 0 | 0 | 2013-06-20T14:42:00.000 | 1 | 1.2 | true | 17,216,646 | 0 | 0 | 1 | 1 | for a website I am making in Django, I need to see what apps a user has downloaded in the past. I know I can federated login through Django and the OpenID to have users login through their google accounts. However, is there any API out there that can allow me to see what android applications this user has downloaded i... |
Running the Command on Windows Command prompt using HTML button | 17,218,531 | 0 | 1 | 6,859 | 0 | html,windows,python-2.7,command,command-prompt | I believe the correct answer is you cannot. Feel free to let me know otherwise if you find out a way to do it. | 0 | 0 | 0 | 1 | 2013-06-20T15:49:00.000 | 1 | 0 | false | 17,218,183 | 0 | 0 | 1 | 1 | I would like to run the command python abc.py in the windows command prompt when the button on html page is clicked.The python file is located at C:/abc.py> I would like to know how to code the html page to do this process.Thank you for the help. |
MATLAB to web app | 17,220,530 | 0 | 0 | 934 | 0 | python,django,matlab,web-applications,octave | You could always just host the MATLAB code and sample .mat on a website for people to download and play with on their own machines if they have a MATLAB license. If you are looking at having some sort of embedded app on your website you are going to need to rewrite your code in another language. The project sounds d... | 0 | 0 | 0 | 0 | 2013-06-20T16:51:00.000 | 2 | 0 | false | 17,219,344 | 0 | 1 | 1 | 2 | Hi I have a MATLAB function that graphs the trajectory of different divers (the Olympic sport diving) depending on the position of a slider at the bottom of the window. The file takes multiple .mat files (with trajectory information in 3 dimensions) as input. I am trying to put this MATLAB app on to the internet. What ... |
MATLAB to web app | 17,224,492 | 1 | 0 | 934 | 0 | python,django,matlab,web-applications,octave | A cheap and somewhat easy way (with limited functionality) would be:
Install MATLAB on your server, or use the MATLAB Compiler to create a stand alone executable (not sure if that comes with your version of MATLAB or not). If you don't have the compiler and can't install MATLAB on your server, you could always go to a ... | 0 | 0 | 0 | 0 | 2013-06-20T16:51:00.000 | 2 | 0.099668 | false | 17,219,344 | 0 | 1 | 1 | 2 | Hi I have a MATLAB function that graphs the trajectory of different divers (the Olympic sport diving) depending on the position of a slider at the bottom of the window. The file takes multiple .mat files (with trajectory information in 3 dimensions) as input. I am trying to put this MATLAB app on to the internet. What ... |
Flask login together with client authentication methods for RESTful service | 21,565,425 | 0 | 0 | 527 | 0 | python,authentication,client,restful-authentication | So, you've officially bumped into one of the most difficult questions in modern web development (in my humble opinion): web authentication.
Here's the theory behind it (I'll answer your question in a moment).
When you're building complicated apps with more than a few users, particularly if you're building apps that hav... | 0 | 0 | 1 | 0 | 2013-06-20T16:59:00.000 | 1 | 0 | false | 17,219,512 | 0 | 0 | 1 | 1 | Here is the situation:
We use Flask for a website application development.Also on the website sever, we host a RESTful service. And we use Flask-login for as the authentication tool, for BOTH the web application access and the RESTful service (access the Restful service from browsers).
Later, we find that we need to, a... |
Is there a way in python to trigger an action upon exiting a function | 17,221,983 | 0 | 1 | 347 | 0 | python,events | Instead of calling that function, make a function that calls both
-function a (your function)
-function b (the exit function code)
call this meta function instead | 0 | 0 | 0 | 0 | 2013-06-20T19:14:00.000 | 2 | 0 | false | 17,221,936 | 1 | 0 | 1 | 1 | I'm in the process of adding a bit of code to a django system that needs to make a specific function call upon exiting a function. Most of the code that I'm updating has several exit points throughout, which requires that I add a one-liner immediately before each one of them. A wee bit ugly.
What I'd like to do is to... |
Why do Flask Extensions exist? | 17,223,377 | 4 | 1 | 99 | 1 | python,sqlalchemy,flask,flask-sqlalchemy | The extensions exist to extend the functionality of Flask, and reduce the amount of code you need to write for common usage patterns, like integrating your application with SQLAlchemy in the case of flask-sqlalchemy, or login handling with flask-login. Basically just clean, reusable ways to do common things with a web ... | 0 | 0 | 0 | 0 | 2013-06-20T20:06:00.000 | 1 | 1.2 | true | 17,222,824 | 0 | 0 | 1 | 1 | Lets take SQLAlchemy as an example.
Why should I use the Flask SQLAlchemy extension instead of the normal SQLAlchemy module?
What is the difference between those two?
Isn't is perfectly possible to just use the normal module in your Flask app? |
Django filter by week | 17,242,425 | 0 | 2 | 1,992 | 0 | python,django,date,python-datetime | There's no predefined query field lookup that can do this for weeks. I'd either reuse code from the WeekArchiveView date-based generic view, or ideally directly subclass it - it already handles the filtering. | 0 | 0 | 0 | 0 | 2013-06-21T18:48:00.000 | 1 | 0 | false | 17,242,335 | 0 | 0 | 1 | 1 | Is there a way to easily filter Date objects by week? Basically I want to do something like
items= RelevantObject.objects.filter(date__week=32)
I've found that it's possible to do this for year and month, but it doesn't seem like the capability for week is built in. Is there a "right" way to do this? It seems like it ... |
Screenshot local page with Selenium and PhantomJS | 17,243,970 | 1 | 0 | 630 | 0 | selenium,python-3.x,local,phantomjs,webpage-screenshot | I feel silly now.
I needed another forward slash
driver.get("file:/// | 0 | 0 | 1 | 0 | 2013-06-21T19:29:00.000 | 1 | 0.197375 | false | 17,242,929 | 0 | 0 | 1 | 1 | I am using Selenium with PhantomJS as the webdriver in order to render webpages using Python.
The pages are on my local drive.
I need to save a screenshot of the webpages.
Right now, the pages all render completely black.
The code works perfect on non-local webpages.
Is there a way to specify that the page is local?
I ... |
What exactly is virtualEnv isolating? Just python related packages or more? | 17,254,371 | 2 | 1 | 457 | 0 | python,virtualenv,virtualenvwrapper | Only python packages installed inside virtualenvironment are isolated.
System packages are not. | 0 | 0 | 0 | 0 | 2013-06-22T19:01:00.000 | 1 | 1.2 | true | 17,254,295 | 1 | 0 | 1 | 1 | When I create a new virtualEnv, if I install Django inside a new environment, it's isolated.
But what if I'm inside a virtualEnv and I install emacs, and mysql or such. These packages have nothing to do with python. Would the emacs and mysql packages that I installed be global or isolated to one virtualEnv only?
Thank... |
Django: Reasonable to store session data in Class Variable? | 17,261,090 | 2 | 1 | 192 | 0 | python,django,class | I see a lot of reasons not to do it.
I'm sure caching solutions offer robust solutions to memory management. This includes running as a daemon. Having cache invalidation, setting lifetimes on the data.
By setting a classvariable, you are forgoing the above things.
Additionally, caching solutions provide a clean do... | 0 | 0 | 0 | 0 | 2013-06-23T12:53:00.000 | 1 | 1.2 | true | 17,260,920 | 0 | 0 | 1 | 1 | I have a class which parses multiple urls/feeds
and stores hashes of entries. Formerly I had put the hashes into a session variable,
but instead of hitting the db I now switched to a class variable in the form of {request.user.id : [hashes]}. Is this bad practice? Any reasons against it? |
Error while using Scrapy : ['scrapy.telnet.TelnetConsole': No module named conch twisted] | 29,180,806 | 0 | 5 | 3,304 | 0 | python,scrapy,twisted | Ensure you have the python development headers:
apt-get install build-essential python-dev
Install scrapy with pip:
pip install Scrapy | 0 | 0 | 0 | 0 | 2013-06-23T17:45:00.000 | 3 | 0 | false | 17,263,509 | 1 | 0 | 1 | 1 | In Ubuntu 13.04, I have installed Scrapy for python-2.7, from the tarball. Executing a crawl command results in the below error:
ImportError: Error loading object 'scrapy.telnet.TelnetConsole': No module named conch
I've also tried installing twisted conch using easy_install and using the tarball. I have also removed... |
How can I find (and scrape) all web pages on a given domain using Python? | 17,265,028 | 0 | 4 | 1,831 | 0 | python,http,dns | You can't. Pages not only can pages be dynamically generated based on backend database data and search queries or other input that your program supplies to the website, but there is a nearly infinite list of possible pages, and the only way to know which ones exist is to test and see.
The closest you can get is to scra... | 0 | 0 | 1 | 0 | 2013-06-19T20:39:00.000 | 2 | 1.2 | true | 17,265,027 | 0 | 0 | 1 | 1 | How would I scrape a domain to find all web pages and content?
For example: www.example.com, www.example.com/index.html, www.example.com/about/index.html and so on..
I would like to do this in Python and preferable with Beautiful Soup if possible.. |
How to seamlessly maintain code of django celery in a multi node environment | 17,270,294 | 2 | 1 | 582 | 0 | python,django,celery,django-celery,celery-task | For this type of situation I have in the past made a egg of all of my celery task code that I can simply rsync or copy in some fashion to my worker nodes. This way you can edit your celery code in a single project that can be used in your django and on your work nodes.
So in summary create a web-app-celery-tasks projec... | 0 | 1 | 0 | 0 | 2013-06-24T05:52:00.000 | 1 | 1.2 | true | 17,268,766 | 0 | 0 | 1 | 1 | I have a Django application which uses django-celery, celery and rabbitmq for offline, distributed processing.
Now the setup is such that I need to run the celery tasks (and in turn celery workers) in other nodes in the network (different from where the Django web app is hosted).
To do that, as I understand I will need... |
"Field not found" when field is present | 17,277,267 | 4 | 1 | 2,904 | 0 | python,quickfix | This message has a repeating group of two MDEntries. Field 290 appears in the first one, but not the second one. Your code is probably trying to extract 290 from the second one, and is thus getting the error.
Group 1 (has 290):
279=2☺55=ZN☺48=00A0IN00ZNZ☺10455=ZNU3☺167=FUT☺207=CBOT☺15=USD☺200=201309☺290=1☺269=0☺270=... | 0 | 0 | 0 | 0 | 2013-06-24T07:37:00.000 | 2 | 1.2 | true | 17,270,259 | 0 | 0 | 1 | 1 | I send a standard Market Data Incremental Refresh Request message (35 = V) and begin receiving incremental refreshes. Most of the time everything is absolutely fine and dandy. However, every once in a while, I get a strange Field not found message. For example:
(8=FIX.4.2☺9=00221☺35=X☺49=XXX☺56=XXX☺34=4☺52=20130624-07... |
What's the recommended way for storing a phone number? | 17,270,535 | 4 | 1 | 191 | 0 | python,django,django-models,phone-number | I always use a simple CharField, since phone numbers differ so greatly from region to region and country to country. Some people might even use characters instead of numbers - according to the numeric keyboard on phones.
Maybe adding a Choicefield for country prefix is a good idea, but that is as far as I would go.
I w... | 0 | 0 | 0 | 0 | 2013-06-24T07:52:00.000 | 3 | 1.2 | true | 17,270,474 | 0 | 0 | 1 | 1 | Trying to get the best way to store a phone # in Django.
At the monent i'm using Charfield and checking if it's a number ... |
Confused about DBus | 17,271,574 | 1 | 1 | 460 | 0 | python,dbus | So does this mean that my website needs to run a DBUS service to
allow me to call methods from it into my program?
A dbus background process (a daemon) would run on your web server, yes.
In fact dbus provides two daemons. One is a system daemon which permits
objects to receive system information (e.g. printer availabi... | 0 | 1 | 0 | 0 | 2013-06-24T08:22:00.000 | 2 | 0.099668 | false | 17,270,936 | 0 | 0 | 1 | 1 | Ok, so, I might be missing the plot a bit here, but would really like some help. I am quite new to development etc. and have now come to a point where I need to implement DBus (or some other inter-program communication). I am finding the concept a bit hard to understand though.
My implementation will be to use an HTML ... |
Good way to convert Python (django) entity classes to Java | 17,273,153 | 1 | 0 | 999 | 0 | java,python,django,converter | Sorry, I can't comment as I have low rep. But would it be an option to parse the python into JSON objects, and Java use Jackson or GSON to parse them back into class objects? | 0 | 0 | 0 | 0 | 2013-06-24T09:17:00.000 | 1 | 1.2 | true | 17,271,955 | 0 | 0 | 1 | 1 | I'm looking for a good way to "copy" / convert a model from Python source code to Java source code. My idea is to use the Python django framework on a server to generate entity model classes. On the other side I would like to convert the entity classes to Java to use them in a native Android project.
Do you have any re... |
How to create models if I am using various types of database simultaneously? | 17,289,054 | 0 | 3 | 79 | 1 | python,database,flask,flask-sqlalchemy | It's not an efficient model, but this would work:
You can write three different APIs (RESTful pattern is a good idea). Each will be an independent Flask application, listening on a different port (likely over localhost, not the public IP interface).
A forth Flask application is your main application that external clien... | 0 | 0 | 0 | 0 | 2013-06-24T13:41:00.000 | 2 | 0 | false | 17,276,970 | 0 | 0 | 1 | 1 | I have a flask application which use three types of databases - MySQL, Mongo and Redis. Now, if it had been simple MySQL I could have use SQLAlchemy or something on that line for database modelling. Now, in the current scenario where I am using many different types of database in a single application, I think I will ha... |
MediaWiki API: can it be used to create new articles programatically? | 17,282,177 | 1 | 1 | 94 | 0 | python,bots,mediawiki-api | You can create a new article simply by editing a page that doesn't exist yet. | 0 | 0 | 1 | 0 | 2013-06-24T16:24:00.000 | 1 | 1.2 | true | 17,280,297 | 0 | 0 | 1 | 1 | I've been charged with migrating a large amount of simple web pages into wikiMedia articles. I've been researching the API and PyWikiBot but it seems that all it allows you to do is edit and retrieve what is already there. Can these tools be used to create a brand new article with content, a title and links to itself e... |
Django Manage.py Gives No South Commands | 17,293,912 | 1 | 3 | 379 | 0 | python,django,django-south,database-migration | If you have installed South in your virtualenv then, once you are in the virtualenv, try to execute python manage.py help instead of ./manage.py help. | 0 | 0 | 0 | 0 | 2013-06-25T02:02:00.000 | 3 | 0.066568 | false | 17,287,996 | 0 | 0 | 1 | 3 | When I do a "./manage.py help", it gives me NO south commands, although South has been installed.
I have the latest version of south installed for my django project, which is South==0.8.1.
I have added "south" to my INSTALLED_APPS in settings.py
I have done a manage.py syncdb, and there is a "south_migrationhistory" da... |
Django Manage.py Gives No South Commands | 23,678,798 | 0 | 3 | 379 | 0 | python,django,django-south,database-migration | You might want to check if the INSTALLED_APPS is not overwritten somewhere outside the settings.py file. E.g. if you are using a separate settings file for a local settings. | 0 | 0 | 0 | 0 | 2013-06-25T02:02:00.000 | 3 | 0 | false | 17,287,996 | 0 | 0 | 1 | 3 | When I do a "./manage.py help", it gives me NO south commands, although South has been installed.
I have the latest version of south installed for my django project, which is South==0.8.1.
I have added "south" to my INSTALLED_APPS in settings.py
I have done a manage.py syncdb, and there is a "south_migrationhistory" da... |
Django Manage.py Gives No South Commands | 17,291,512 | 0 | 3 | 379 | 0 | python,django,django-south,database-migration | If you're using virtualenv, ensure that it is activated when running ./manage.py help command. Django will just pass all import errors when showing available commands. | 0 | 0 | 0 | 0 | 2013-06-25T02:02:00.000 | 3 | 0 | false | 17,287,996 | 0 | 0 | 1 | 3 | When I do a "./manage.py help", it gives me NO south commands, although South has been installed.
I have the latest version of south installed for my django project, which is South==0.8.1.
I have added "south" to my INSTALLED_APPS in settings.py
I have done a manage.py syncdb, and there is a "south_migrationhistory" da... |
Flask end response and continue processing | 17,308,839 | 4 | 30 | 24,216 | 0 | python,flask | I had a similar problem with my blog. I wanted to send notification emails to those subscribed to comments when a new comment was posted, but I did not want to have the person posting the comment waiting for all the emails to be sent before he gets his response.
I used a multiprocessing.Pool for this. I started a pool ... | 0 | 0 | 0 | 0 | 2013-06-25T09:09:00.000 | 6 | 0.132549 | false | 17,293,311 | 0 | 0 | 1 | 1 | Is there a way in Flask to send the response to the client and then continue doing some processing? I have a few book-keeping tasks which are to be done, but I don't want to keep the client waiting.
Note that these are actually really fast things I wish to do, thus creating a new thread, or using a queue, isn't really ... |
How to debug a Flask app | 52,030,732 | 3 | 174 | 341,826 | 0 | python,debugging,flask | Quick tip - if you use a PyCharm, go to Edit Configurations => Configurations and enable FLASK_DEBUG checkbox, restart the Run. | 0 | 0 | 0 | 0 | 2013-06-26T00:51:00.000 | 17 | 0.035279 | false | 17,309,889 | 0 | 0 | 1 | 5 | How are you meant to debug errors in Flask? Print to the console? Flash messages to the page? Or is there a more powerful option available to figure out what's happening when something goes wrong? |
How to debug a Flask app | 54,051,191 | 1 | 174 | 341,826 | 0 | python,debugging,flask | Use loggers and print statements in the Development Environment, you can go for sentry in case of production environments. | 0 | 0 | 0 | 0 | 2013-06-26T00:51:00.000 | 17 | 0.011764 | false | 17,309,889 | 0 | 0 | 1 | 5 | How are you meant to debug errors in Flask? Print to the console? Flash messages to the page? Or is there a more powerful option available to figure out what's happening when something goes wrong? |
How to debug a Flask app | 58,817,088 | 10 | 174 | 341,826 | 0 | python,debugging,flask | To activate debug mode in flask you simply type set FLASK_DEBUG=1 on your CMD for windows, or export FLASK_DEBUG=1 on Linux terminal then restart your app and you are good to go!! | 0 | 0 | 0 | 0 | 2013-06-26T00:51:00.000 | 17 | 1 | false | 17,309,889 | 0 | 0 | 1 | 5 | How are you meant to debug errors in Flask? Print to the console? Flash messages to the page? Or is there a more powerful option available to figure out what's happening when something goes wrong? |
How to debug a Flask app | 41,045,846 | -4 | 174 | 341,826 | 0 | python,debugging,flask | If you are running it locally and want to be able to step through the code:
python -m pdb script.py | 0 | 0 | 0 | 0 | 2013-06-26T00:51:00.000 | 17 | -1 | false | 17,309,889 | 0 | 0 | 1 | 5 | How are you meant to debug errors in Flask? Print to the console? Flash messages to the page? Or is there a more powerful option available to figure out what's happening when something goes wrong? |
How to debug a Flask app | 71,165,056 | 0 | 174 | 341,826 | 0 | python,debugging,flask | If you're using VSCode, press F5 or go to "Run" and "Run Debugging". | 0 | 0 | 0 | 0 | 2013-06-26T00:51:00.000 | 17 | 0 | false | 17,309,889 | 0 | 0 | 1 | 5 | How are you meant to debug errors in Flask? Print to the console? Flash messages to the page? Or is there a more powerful option available to figure out what's happening when something goes wrong? |
Is there any simple way to check radio buttons when page loads, based on the what is checked before the page submit? | 17,315,760 | 1 | 0 | 125 | 0 | python,django,django-templates | Since requests are stateless, you will have to somehow "save" the state of your radio buttons. One option would be to use sessions, the other would be to use a form and instantiate it with the submitted data. | 0 | 0 | 0 | 0 | 2013-06-26T08:33:00.000 | 1 | 1.2 | true | 17,315,214 | 0 | 0 | 1 | 1 | I am using django.
My webpage works like this, If i check the radio button and click on submit. it redirects to the same page with jobs redefined on the basis of which radiobuttons were checked. My problem is after loading the page none of the radio buttons are checked.
so I would like to know is there any method so th... |
Determining sound quality from an audio recording? | 17,323,482 | 0 | 2 | 3,067 | 0 | python,audio,noise | Not quite my field but I suspect that if you get a spectrum, (do a Fourier transform maybe), and compare "good" and "noisy" recordings you will find that the noise contributes to a cross spectrum level that is higher in the bad recordings than the good. Take a look at the signal processing section in SciPy - this can ... | 0 | 0 | 0 | 1 | 2013-06-26T14:37:00.000 | 3 | 0 | false | 17,323,142 | 0 | 0 | 1 | 2 | Is there any way to algorithmically determine audio quality from a .wav or .mp3 file?
Basically I have users with diverse recording setups (i.e. they are from all over the world and I have no control over them) recording audio to mp3/wav files. At which point the software should determine whether their setup is okay or... |
Determining sound quality from an audio recording? | 17,326,588 | 1 | 2 | 3,067 | 0 | python,audio,noise | It all depends on what your quality problems are, which is not 100% clear from your question, but here are some suggestions:
In the case where volume is high and clarity is low, I'm guessing the problem is that the user has the input gain too high. After the recording, you can simply check for distortion. Even better, ... | 0 | 0 | 0 | 1 | 2013-06-26T14:37:00.000 | 3 | 0.066568 | false | 17,323,142 | 0 | 0 | 1 | 2 | Is there any way to algorithmically determine audio quality from a .wav or .mp3 file?
Basically I have users with diverse recording setups (i.e. they are from all over the world and I have no control over them) recording audio to mp3/wav files. At which point the software should determine whether their setup is okay or... |
django i18n msgstr quote is escaped twice | 23,383,849 | 0 | 1 | 190 | 0 | python,django,escaping | The problem is resolved with django 1.6
You can update with :
sudo pip install -U django | 0 | 0 | 0 | 0 | 2013-06-26T18:57:00.000 | 1 | 0 | false | 17,328,275 | 0 | 0 | 1 | 1 | Some of my texts are escaped twice after upgrading from django 1.4 to django 1.5
For instance one label in my template "{{ field.label_tag }}" is displayed as "Email ou nom d'utilisateur".
Is there something to change in the settings to avoid the double escaping?
The text "Email ou nom d'utilisateur" comes file dja... |
Navigate to a specific module in PyCharm | 17,909,331 | 3 | 4 | 1,264 | 0 | python,django,pycharm | I feel your problem. All you have to do is Ctrl + CLICK on the definition. Please note, however that this does not provide the actual files. What I mean by this is that it does not re-direct you to the actual function, but rather a skeleton of the function.
If you want to go to the actual function, you will need to go ... | 0 | 0 | 0 | 0 | 2013-06-26T20:41:00.000 | 1 | 0.53705 | false | 17,330,079 | 1 | 0 | 1 | 1 | I use PyCharm as my IDE for working with Django. So far, it's navigation shortcuts have proven very useful. I can go to a specific (project) file with Ctrl+Shift+N, I can go to any class definition with Ctrl+N and can go to any symbol with Ctrl+Shift+Alt+N.
This is great, but lately I've seen that it would be very usef... |
how to add field for multiple image attachment in openerp module | 17,343,886 | 0 | 0 | 1,243 | 0 | python,eclipse,openerp | Add a many2many field relating to ir.attachments.Check sent by email button in invoice. It opens a wizard which we can add many attachments and also email body
for example, add a many2many field relating to ir.attachement and in xml line of the field, specify widget="many2many_binary"
I dont know whether it is possible... | 0 | 0 | 0 | 0 | 2013-06-27T10:44:00.000 | 1 | 0 | false | 17,341,034 | 0 | 0 | 1 | 1 | Hi I have created a custom openerp module having several fields . I also have a field for attaching image file . But now I need to have a field that should have the ability to attach multiple image fields. How Can I be able to do this?
Hopes for suggestion |
How to authenticate a user in a RESTful api and get their user id? (Tornado) | 17,350,408 | 0 | 1 | 513 | 0 | python,rest,authentication,tornado,userid | I am assuming that your authentication function talks to a database and that each page in you app hits the database one or more times.
With that in mind, you should probably just authenticate each request. Many cloud/web applications have multiple database queries per page and run just fine. So when performance does ge... | 0 | 1 | 0 | 0 | 2013-06-27T16:17:00.000 | 1 | 0 | false | 17,348,253 | 0 | 0 | 1 | 1 | I would like to maintain statelessness but I also don't want to call my login function on each authenticated request. Would using tornado's secure cookie functionality be feasible for storing the userid in each request for a mobile app? I'm trying to keep performance in mind, so although basic http authentication wou... |
Long-running I/O-bound processes in AppEngine: tasks or threads? | 17,354,787 | 0 | 2 | 193 | 0 | python,google-app-engine,asynchronous | It depends on how long the "interaction" takes. Appengine has a limit of 60 seconds per HTTP Requests.
If your external systems send data periodically then I would advice to grab the data in small chunks to respect the 60 seconds limit. Aggregate those into blobs and then process the data periodically using tasks. | 0 | 1 | 0 | 0 | 2013-06-27T18:31:00.000 | 1 | 1.2 | true | 17,350,684 | 0 | 0 | 1 | 1 | My Python AppEngine app interacts with slow external systems (think receiving data from narrow-band connections). Half-hour-long interactions are a norm. I need to run 10-15 of such interactions in parallel.
My options are background tasks and "background threads" (not plain Python threads). Theoretically they look abo... |
Django Dynamic Scraper Project does not run on windows even though it works on Linux | 17,374,282 | 0 | 0 | 194 | 0 | python,django,web-scraping,scraper,scraperwiki | Step # 1
download django-dynamic-scraper-0.3.0-py2.7.tar.gz file
Step # 2
Unzip it and change the name of the folder to:
django-dynamic-scraper-0.3.0-py2.7.egg
Step # 3
paste the folder into C:\Python27\Lib\site-packages | 0 | 1 | 0 | 0 | 2013-06-28T11:53:00.000 | 1 | 0 | false | 17,364,120 | 0 | 0 | 1 | 1 | I am trying to make a project in dynamic django scraper. I have tested it on linux and it runs properly. When I try to run the command: syndb i get this error
/*****************************************************************************************************************************/
python : WindowsError: [Error 3] ... |
Scraping Contact Information from Several Unique Sites with Python | 17,366,729 | 1 | 3 | 2,766 | 0 | python,web-scraping,beautifulsoup,screen-scraping | In most countries the telephone number follows one of a very few well defined patterns that can be matched with a simple regexp - likewise email addresses have an internationally recognised format - simply scrape the homepage, contacts or contact us page and then parse with regular expressions - you should easily achie... | 0 | 0 | 1 | 1 | 2013-06-28T14:03:00.000 | 2 | 0.099668 | false | 17,366,528 | 0 | 0 | 1 | 1 | I'd like to scrape contact info from about 1000-2000 different restaurant websites. Almost all of them have contact information either on the homepage or on some kind of "contact" page, but no two websites are exactly alike (i.e., there's no common pattern to exploit). How can I reliably scrape email/phone # info from ... |
How does Django handle foreignKeys internally? | 17,369,468 | 3 | 0 | 38 | 0 | python,django,metaprogramming,metaclass | The field name in the model has _id appended to it in the table, and it stores the PK of the foreign model (as a FK normally would).
When the related field is accessed on a model, Django performs a query to retrieve the foreign model from the database.
When a model is assigned to the related field, Django reads the PK ... | 0 | 0 | 0 | 0 | 2013-06-28T16:27:00.000 | 1 | 1.2 | true | 17,369,422 | 0 | 0 | 1 | 1 | I am curious how Django handles model relationships at the object level because I am working on building a custom json serializer, and I need to understand this so I have properly handle nested serialization. I am almost positive I will have to dive into some of the internals of python, but that will not be too big of ... |
Application producing invalid JSON | 17,406,851 | 0 | 1 | 131 | 0 | python,json,flask,ascii,octal | I ended up passing a urlencoded cookie instead of json. This is a hack. I am not really satisfied with this fix right now. | 0 | 0 | 0 | 0 | 2013-06-28T20:42:00.000 | 1 | 1.2 | true | 17,373,333 | 1 | 0 | 1 | 1 | I have written an application using flask. Part of the application creates a dictionary and then the dictionary gets parsed into json(string) with json.dumps. The string then gets stored as a cookie. Everything was working fine in development.
I set up a production environment and when the above process takes place, I ... |
Python: Create and return an SQLite DB as a web request result | 17,382,483 | 1 | 0 | 169 | 1 | python,django,sqlite | I'm not sure you can get at the contents of a :memory: database to treat it as a file; a quick look through the SQLite documentation suggests that its API doesn't expose the :memory: database to you as a binary string, or a memory-mapped file, or any other way you could access it as a series of bytes. The only way to a... | 0 | 0 | 0 | 0 | 2013-06-29T16:01:00.000 | 2 | 1.2 | true | 17,382,053 | 0 | 0 | 1 | 1 | In my python/django based web application I want to export some (not all!) data from the app's SQLite database to a new SQLite database file and, in a web request, return that second SQLite file as a downloadable file.
In other words: The user visits some view and, internally, a new SQLite DB file is created, populate... |
Database design, adding an extra column versus converting existing column with a function | 17,393,525 | 1 | 0 | 50 | 1 | python,mysql,django | Having a string-valued PK should not be a problem in any modern database system. A PK is automatically indexed, so when you perform a look-up with a condition like table1.pk = 'long-string-key', it won't be a string comparison but an index look-up. So it's ok to have string-valued PK, regardless of the length of the ke... | 0 | 0 | 0 | 0 | 2013-06-30T18:03:00.000 | 1 | 1.2 | true | 17,393,291 | 0 | 0 | 1 | 1 | suppose there was a database table with one column, and it's a PK. To make things more specific this is a django project and the database is in mysql.
If I needed an additional column with all unique values, should I create a new UniqueField with unique integers, or just write a hash-like function to convert the exis... |
Cassandra-Django python application approach | 17,403,637 | 3 | 1 | 410 | 1 | python,django,orm,cassandra | There's an external backend for Cassandra, but it has some issues with the authentication middleware, which doesn't handle users correctly in the admin. If you use a non-relational database, you lose a lot of goodies that django has. You could try using Postgres' nosql extension for the parts of your data that you want... | 0 | 0 | 0 | 0 | 2013-07-01T11:25:00.000 | 2 | 1.2 | true | 17,403,346 | 0 | 0 | 1 | 1 | i am working on developing a Django application with Cassandra as the back end database. while Django supports ORM feature for SQL, i wonder if there is any thing similar for Cassandra.
what would be the best approach to load the schema into the Cassandra server and perform CRUD operations.
P.S. I am complete beginner ... |
openerp not loading on localhost | 17,486,874 | 0 | 0 | 1,240 | 0 | python,eclipse,openerp | Verify that the OpenERP service is running on your computer. You can verify this by clicking on the Taskbar -> task manager -> Services.
Look for the OpenERP service and start it if it is not running.
A problem might have made it fail to start. There might be errors with your custom module.
I tell you developing cust... | 0 | 0 | 1 | 0 | 2013-07-02T07:21:00.000 | 1 | 0 | false | 17,419,724 | 0 | 0 | 1 | 1 | Hi I have been working on openerp-7 (win-7) custom module creation . I have been loading openerp server through localhost:8069 . But today the application failed to start and its generating error " Oops! Google Chrome could not connect to localhost:8069 " . What should I do now to fix this issue?
Plz help
Hopes for su... |
Selenium versus BeautifulSoup for web scraping | 55,484,972 | 3 | 55 | 40,675 | 0 | javascript,python,selenium,beautifulsoup | I would recommend using Selenium for things such as interacting with web pages whether it is in a full blown browser, or a browser in headless mode, such as headless Chrome. I would also like to say that beautiful soup is better for observing and writing statements that rely on if an element is found or WHAT is found, ... | 0 | 0 | 1 | 0 | 2013-07-02T21:19:00.000 | 3 | 0.197375 | false | 17,436,014 | 0 | 0 | 1 | 1 | I'm scraping content from a website using Python. First I used BeautifulSoup and Mechanize on Python but I saw that the website had a button that created content via JavaScript so I decided to use Selenium.
Given that I can find elements and get their content using Selenium with methods like driver.find_element_by_xpat... |
Testing concurrent access in GAE | 17,441,520 | 1 | 0 | 221 | 0 | google-app-engine,python-2.7,app-engine-ndb | Please vote if it solve your problem :)
GAE works like that:
You can have multiple instances of program with separated code space - mean instance has not access to other instance.
You can have multiple threads in program instance if you mark code as thread safe - mean each instance has access to same code/memory (coun... | 0 | 1 | 0 | 0 | 2013-07-03T05:27:00.000 | 1 | 0.197375 | false | 17,440,323 | 0 | 0 | 1 | 1 | Is it possible to simulate concurrent access to a piece of code in Google App Engine? I am trying to unit test a piece of code that increments a counter. It is possible that the code will be used by different instances of the app concurrently and although I have made the datastore access sections transactional and also... |
How to create field through func in openerp? | 17,447,105 | 0 | 1 | 198 | 0 | python,eclipse,openerp | You can create field on function, you have to create field in object 'ir.model.fields'
if you are create simple field like float. char, boolean then you have to give value Field Name, Label, Model, for which object you want to create field , if many2one or many2many field then you have to give Object Relation field to.... | 0 | 0 | 0 | 0 | 2013-07-03T11:26:00.000 | 1 | 0 | false | 17,446,703 | 0 | 0 | 1 | 1 | Hi I have created a button oin my custom openerp module. I wanted to add func to this button to create a field. I have added the function but how to add functionality for creating fields . please help |
Why doesn't Django support Single Table Inheritance? | 17,460,337 | 0 | 0 | 147 | 0 | python,django,database-design,frameworks,relational-database | One reason is possibly that Django does not (currently) have the ability to modify database tables after creation.
You can 'kind-of' do STI using proxy models. This will not allow you to have different fields on the different models, but it will allow you to attach different behaviour (via model methods) to different s... | 0 | 0 | 0 | 0 | 2013-07-03T23:23:00.000 | 1 | 0 | false | 17,459,680 | 0 | 0 | 1 | 1 | What is the rationale behind the decision to not support Single Table Inheritance in Django?
Is STI a bad design? Does it result in poor performance? Would it conflict with the Django ORM as it is?
Just wondering because it's been a missing feature for like ten years now and so there must have been a conscious decisi... |
after working in local server, how to move OpenERP on a remote server? | 17,473,961 | 1 | 0 | 2,217 | 0 | python,xml,postgresql,openerp | This is not a generally accepted way of doing customization in openerp. Ususally, you should make a custom module that implements your customization when installed on the OpenERP server installation.
Are you using Windows or Linux? The concept here is to move all of the server addons files to the upsite server, includi... | 0 | 0 | 1 | 0 | 2013-07-04T11:38:00.000 | 1 | 1.2 | true | 17,469,330 | 0 | 0 | 1 | 1 | I installed OpenERP V 7 on my local machine. I made modification in the CSS. I also remove some menu, change the labels of some windows and change the position of some menus (one after the other in the order decided by the customer).
The work required is over and runs well on the premises. Now I'm looking for a way t... |
GAE does not release memory after handling request? | 20,981,660 | 0 | 4 | 135 | 0 | python,google-app-engine | Like dragonx wrote every handler which was run, every global variable, import is cached on GAE so how long your instance is running so big she is. You can reconfigure your app settings to faster creating new instances and killing old's. That will give you a little chance to minimize that error.
That error doesn't have ... | 0 | 0 | 0 | 0 | 2013-07-04T12:14:00.000 | 1 | 0 | false | 17,470,073 | 1 | 0 | 1 | 1 | Why does this happen?
I run a task which uses a lot of memory - after the task has finished I would expect the memory to be released back to the instance.
However, this doesn't happen. The memory just keeps going up and up on subsequent execution of the task until eventually I get a soft memory warning.
What can I do a... |
Django DeleteView without confirmation template | 17,475,364 | 1 | 30 | 21,411 | 0 | python,django | Yes, just change the next parameter. In your return response, make sure that the dictionary that you pass in is has something like this : { 'next': '/<your_path_here>}/' }, make sure you commit the changes before adding the next parameter. You might want to change your view's get and post functions. | 0 | 0 | 0 | 0 | 2013-07-04T17:03:00.000 | 5 | 0.039979 | false | 17,475,324 | 0 | 0 | 1 | 1 | I am using Django DeleteView in a template and I've created a url & view.
Is it possible to skip the process of loading the _confirm_delete template and just post the delete immediately. |
Moving database from PMA to Django | 17,491,830 | 0 | 0 | 62 | 1 | python,mysql,django,phpmyadmin | You can use the to_field attribute of a ForeignKey.
Django should detect this automatically if you use ./manage.py inspectdb, though. | 0 | 0 | 0 | 0 | 2013-07-05T14:54:00.000 | 1 | 0 | false | 17,491,720 | 0 | 0 | 1 | 1 | I have an existing MySQL database that I set up on PMA, it has FKs that references columns that are not primary keys. Now I am trying to move the database to Django and am having trouble because when I try to set up d Foreign Keys in django it automatically references the Primary Key of the table that I am attempting t... |
What is the correct way to expose an AWS in an API without giving out your keys? | 17,906,399 | 0 | 0 | 106 | 0 | python,amazon-web-services,amazon-sqs | It depends on your identity requirements. If it's ok for your clients to have AWS accounts, you can give their accounts permission to send messages to your queue. If you want your own identity, then yes, you would need to build a service layer infront of AWS to broker API requests | 0 | 0 | 1 | 0 | 2013-07-06T21:39:00.000 | 1 | 0 | false | 17,507,395 | 0 | 0 | 1 | 1 | Sorry about the awkward title.
I am building a Python API. Part of it involves sending and receiving data to an Amazon SQS to communicate with some stuff on an EC2 instance. I don't want to distribute the API with my amazon keys in it though.
What is the correct way around an issue like this? Do I have to write a sep... |
where to place .htaccess on elastic beanstalk python | 17,511,404 | 0 | 3 | 731 | 0 | python,django,amazon-web-services,amazon-elastic-beanstalk | Apache's AllowOverride is set to None by default. You have to do some .ebextensions touches to change the default AllowOverride on your DocumentRoot folder.
You can verify this by connecting to your instance through ssh and check the httpd config. | 0 | 0 | 0 | 0 | 2013-07-07T05:03:00.000 | 1 | 0 | false | 17,509,446 | 0 | 0 | 1 | 1 | I'm trying to remove the www from the url, and normally I do this by using a .htaccess file with a rewrite rule. I don't know where to put this file in my elastic beanstalk folder structure, or where to have it created.
I've tried placing my .htaccess in
1. /var/www/html
2. django application folder
3. the same folde... |
Why does Django's User Model set the email field as non-unique? | 17,514,616 | 0 | 6 | 2,484 | 0 | python,django,security,django-models | django.contrib.auth uses the username field to identify a user, not the email address, so there is no conflict if two users have the same email address.
Also, since the email address is not required, it is therefore blank or null in the database (neither of which make for good unique keys).
And for your other questio... | 0 | 0 | 0 | 0 | 2013-07-07T17:15:00.000 | 2 | 0 | false | 17,514,348 | 0 | 0 | 1 | 1 | I am using Django's default User model and the email is not unique, now I have multiple users with the same email address.
You can have User_A with email address user_a@example.com, and then a new user User_B can register with the same email address user_a@example.com.
This doesn't make sense in any programming univers... |
Appengine errors not appearing in logs | 17,520,267 | 0 | 0 | 63 | 0 | python,google-app-engine,error-handling | When I was taking some screenshots as tony asked in the comments, I found the solution.
These errors are all HEAD requests. Since my app doesn't support them, they generate a 405 HTTP response code which is shown on the dashboard as error but then in the logs they don't get the error icon. They just seem to be fine at ... | 0 | 1 | 0 | 0 | 2013-07-07T19:36:00.000 | 1 | 1.2 | true | 17,515,574 | 0 | 0 | 1 | 1 | I have the following problem:
I can see some mysterious errors on the Appengine Dashboard but when I go to the logs I can't find any relevant entries. Otherwise the URIs are working fine when I request them.
If I click on the links on the dashboard which take me to the logs with a prefilled regexp filter, the logs are ... |
Scientific Reporting in Python | 17,526,180 | 1 | 4 | 1,861 | 0 | python,ipython,jinja2,ipython-notebook | Using the inline-modus of ipython notebook,
ipython notebook --pylab inline
you can execute your matplotlib-scripts in a browser interactively (thus generating your plots). Then go to
File -> Print View (in the notebook-menu, NOT the browser menu)
and save the generated html-File (via the browser menu). This will ... | 0 | 0 | 0 | 0 | 2013-07-08T11:33:00.000 | 4 | 0.049958 | false | 17,525,595 | 0 | 0 | 1 | 1 | I am working on a scientific python project performing a bunch of computations generating a lot of data.
The problem comes when reports have to be generated from these data, with images embedded (mostly computed with matplotlib). I'd like to use a python module or tool to be able to describe the reports and "build" HTM... |
What is the purpose of app.py in django apps? | 17,533,814 | 3 | 0 | 2,402 | 0 | python,django,web | Even though the details are wrong (there's no app.py in new Django projects), the question is still valid.
__init__.py is imported implicitly when importing a sub-module. So if something in __init__.py executes automatically with side effects, you might run into unintended consequences. Doing everything in app.py inc... | 0 | 0 | 0 | 0 | 2013-07-08T18:35:00.000 | 3 | 0.197375 | false | 17,533,631 | 0 | 0 | 1 | 2 | In Django 1.4 and above :
There is a new file called app.py in every django application. It defines the scope of the app and some initials required when loaded.
Why don't they use __init__.py for the purpose? Any advantage over __init__.py approach? Can you link to some official documentation for the same? |
What is the purpose of app.py in django apps? | 17,535,359 | 2 | 0 | 2,402 | 0 | python,django,web | As all the links you have provided clearly show, this is nothing at all to do with Django itself, but a convention applied by the third-party app django-oscar. | 0 | 0 | 0 | 0 | 2013-07-08T18:35:00.000 | 3 | 1.2 | true | 17,533,631 | 0 | 0 | 1 | 2 | In Django 1.4 and above :
There is a new file called app.py in every django application. It defines the scope of the app and some initials required when loaded.
Why don't they use __init__.py for the purpose? Any advantage over __init__.py approach? Can you link to some official documentation for the same? |
How to generate a secure temporary url to download file from Amazon S3? | 17,759,017 | 1 | 0 | 1,631 | 0 | python,amazon-s3 | Make sure that the expiration time of the link is set to a very short time. Then make sure that you are communicating with the user via SSL, and that the link provided is SSL. When using an SSL connection, both the data from the page and the URL are encrypted, and no one 'sniffing' the data should be able to see anyt... | 0 | 0 | 1 | 0 | 2013-07-09T11:04:00.000 | 1 | 1.2 | true | 17,546,608 | 0 | 0 | 1 | 1 | I am trying to give user a temporary link to download files from Amazon S3 bucket in python.
I am using generate_url method which generates the url for a specified time peiod.
My concern is when this link is created,anyone including the desired user can hit this url in that time period and get the files.How can I preve... |
Py.Test : Reporting and HTML output | 17,595,687 | 34 | 26 | 41,617 | 0 | python,reporting,pytest | I think you also need to specify the directory/file you want coverage for like py.test --cov=MYPKG --cov-report=html after which a html/index.html is generated. | 0 | 0 | 0 | 1 | 2013-07-09T20:41:00.000 | 3 | 1.2 | true | 17,557,813 | 0 | 0 | 1 | 1 | This is not a technical question at all really. However, I can not locate my .HTML report that is supposed to be generated using:
py.test --cov-report html pytest/01_smoke.py
I thought for sure it would place it in the parent location, or the test script location. Does neither and I have not been able to locate. So I... |
how do I track how many users visit my website | 17,579,664 | 5 | 9 | 11,232 | 0 | python,flask,pythonanywhere | PythonAnywhere Dev here. You also have your access log. You can click through this from your web app tab. It shows you the raw data about your visitors. I would personally also use something like Google Analytics. However you don't need to do anything to be able to just see your raw visitor data. It's already there. | 0 | 0 | 0 | 0 | 2013-07-09T23:24:00.000 | 4 | 0.244919 | false | 17,559,967 | 0 | 0 | 1 | 1 | I just deployed my first ever web app and I am curious if there is an easy way to track every time someone visits my website, well I am sure there is but how? |
Can I scrape data from web pages when the data comes from JavaScript? | 17,578,385 | 0 | 1 | 119 | 0 | javascript,python,html | Although your question isn't very clear. I'm guessing that you are trying to access the javascript console.
In Google Chrome:
Press F12
Go to the 'console' tab
In Mozilla Firefox with Firebug installed:
Open Firebug
Go to the 'console' tab
From the console you can execute javascript query's (calling functions, a... | 0 | 0 | 1 | 0 | 2013-07-10T18:29:00.000 | 3 | 0 | false | 17,578,253 | 0 | 0 | 1 | 1 | I'm not exactly sure how to phrase my question but I'll give it my best shot.
If I load up a webpage, in the HTML it executes a JavaScript file. And if I view the page source I can see the source of that JavaScript (though it's not very well formatted and hard to understand).
Is there a way to run the JavaScript from ... |
Django runserver bound to 0.0.0.0, how can I get which IP took the request? | 17,599,320 | 0 | 6 | 10,672 | 0 | python,django,manage.py | If your goal is to ensure the load balancer is working correctly, I suppose it's not an absolute requirement to do this in the application code. You can use a network packet analyzer that can listen on a specific interface (say, tcpdump -i <interface>) and look at the output. | 0 | 1 | 0 | 0 | 2013-07-11T13:44:00.000 | 2 | 0 | false | 17,595,066 | 0 | 0 | 1 | 1 | I'm running a temporary Django app on a host that has lots of IP addresses. When using manage.py runserver 0.0.0.0:5000, how can the code see which of the many IP addresses of the machine was the one actually hit by the request, if this is even possible?
Or to put it another way:
My host has IP addresses 10.0.0.1 and 1... |
Python web crawler multithreading and multiprocessing | 17,601,331 | 0 | 0 | 763 | 0 | python,multithreading,performance,multiprocessing,web-crawler | Look into grequests, it doesn't do actual muti-threading or multiprocessing, but it scales much better than both. | 0 | 1 | 1 | 0 | 2013-07-11T18:51:00.000 | 1 | 0 | false | 17,601,124 | 0 | 0 | 1 | 1 | Briefly idea, My web crawler have 2 main jobs. Collector and Crawler, The collector will collecting all of the url items for each sites and storing non duplicated url. The crawler will grab the urls from storage, extract needed data and store its back.
2 Machines
Bot machine -> 8 core, Physical Linux OS (No VM on th... |
table specific data in django models | 17,604,930 | 1 | 0 | 66 | 0 | python,django | In SQL database it would be easiest to create an additional table which would hold a reference to (for example) thread table and user table. Call it (for example) ThreadVisitors.
Whenever a user visits a thread you create an entry in that table for that user and the thread (you could add a unique constraint on (thread,... | 0 | 0 | 0 | 0 | 2013-07-11T22:33:00.000 | 1 | 1.2 | true | 17,604,692 | 0 | 0 | 1 | 1 | Where to store table specific data in django models ?
Here is the scenario
I am making a forum. In each thread, there will be following two kinds of visitors.
Total Visitors
Current Visitors
My model is designed in the following manner
Category model(will contain sub category)
Sub-Category model(will contain sub-ca... |
Checking login status at every page load in CherryPy | 17,606,832 | 2 | 1 | 313 | 0 | python,web,cherrypy | Nevermind, folks. Turns out that this isn't so bad to do; it is simply a matter of doing the following:
Write a function that does what I want.
Make the function in to a custom CherryPy Tool, set to the before_handler hook.
Enable that tool globally in my config. | 0 | 0 | 0 | 0 | 2013-07-12T02:35:00.000 | 1 | 1.2 | true | 17,606,646 | 0 | 0 | 1 | 1 | I am in the midst of writing a web app in CherryPy. I have set it up so that it uses OpenID auth, and can successfully get user's ID/email address.
I would like to have it set so that whenever a page loads, it checks to see if the user is logged in, and if so displays some information about their login.
As I see it, t... |
Turbogears on bluehost | 17,742,500 | 1 | 0 | 72 | 0 | python,apache,cherrypy,turbogears | From what I can see from their website, bluehost supports using FastCGI.
In that case you can deploy your applications using FLUP
flup.server.fcgi.WSGIServer permits to mount any WSGI application (like TurboGears apps) and use them with fastcgi. | 0 | 0 | 0 | 1 | 2013-07-12T09:50:00.000 | 1 | 1.2 | true | 17,612,117 | 0 | 0 | 1 | 1 | Has anyone successfully installed TurboGears or CherryPy on BlueHost? There are listings on the web, but none of them are viable or the links to the scripts are broken.
However, Bluehost Tech support claims that some folks are running TurboGears successfully on their shared hosting.
Anyone who has a setup or knows h... |
Enable programmatic billing for Amazon AWS through API (python) | 17,630,560 | 0 | 0 | 356 | 0 | python,amazon-web-services,boto | Currently, there is no API for doing this. You have to log into your billing preference page and set it up there. I agree that an API would be a great feature to add. | 0 | 0 | 1 | 1 | 2013-07-13T05:51:00.000 | 1 | 1.2 | true | 17,627,389 | 0 | 0 | 1 | 1 | Was wondering if anyone knew how if it was possible to enable programmatic billing for Amazon AWS through the API? I have not found anything on this and I even went broader and looked for billing preferences or account settings through API and still had not luck. I assume the API does not have this functionality but ... |
Jython and Python Lib Dependencies | 18,564,145 | 0 | 0 | 312 | 0 | python,maven,dependencies,jython | ObsPy relies on ctypes which works only for CPython - so I'm afraid you won't get it running under Jython. | 0 | 1 | 0 | 0 | 2013-07-13T21:36:00.000 | 1 | 0 | false | 17,634,435 | 1 | 0 | 1 | 1 | I am contributing on an open source Java project, and I am trying to use the Python tool ObsPy via the Jython PythonInterpreter. My problem is that I am having trouble figuring out how to include the ObsPy library in the Jython buildpath. Is it possible to use Maven in order to include the ObsPy library in a manner tha... |
accessing a MBean which is boolean in wlst | 17,650,190 | 0 | 1 | 938 | 0 | python,weblogic,mbeans,wlst | Have you tried with the only get method like this :
var=get('PausedForForwarding'); print var | 0 | 0 | 0 | 0 | 2013-07-13T23:57:00.000 | 3 | 0 | false | 17,635,271 | 0 | 0 | 1 | 2 | Need to access a boolean value under Store and Forward Agent ...
already inside the SAF_Agent and once i do a ls(), i see a list of operations and attributes. I can perform the operations, but i am unable to get one of the attributes
the attribute is PausedForForwarding which is a boolean true or false which currently ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.