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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Upvote and Downvote buttons with Django forms | 14,678,289 | 0 | 3 | 829 | 0 | python,django,django-forms | I would suggest, you use separate view login for up and down voting.
Something like this /upvote/{{comment.pk|urlize}}
and then write a view that works with this url. With PK find the comment that the user is trying to up/down vote, then write the necessary condition to check if the user is authorized to perform that k... | 0 | 0 | 0 | 0 | 2013-02-03T21:34:00.000 | 1 | 1.2 | true | 14,677,548 | 0 | 0 | 1 | 1 | I want to make upvote and downvote buttons for comments but I want all the form inputs that django.contrib.comments.forms.CommentSecurityForm gives me to make sure the form is secure. Is that necessary? And if so, how do I make a form class that with upvote and downvote buttons? Custom checkbox styles? |
Storing subprocess object in memory using global singleton instance | 14,691,638 | 1 | 1 | 1,465 | 0 | python,django,subprocess | You can use the same technique in Python as you did in Java, that is store the reference to the process in a module variable or implement a kind of a singleton.
The only problem you have as opposed to Java, is that Python does not have that rich analogy to the Servlet specification, and there is no interface to handle... | 0 | 1 | 0 | 0 | 2013-02-04T05:44:00.000 | 2 | 0.099668 | false | 14,681,015 | 1 | 0 | 1 | 1 | So I am using subprocess to spawn a long running process through the web interface using Django. Now if a user wants to come back to the page I would like to give him the option of terminating the subprocess at a later stage.
How can do this? I implemented the same thing in Java and made a global singleton ProcessManag... |
How to export virtualenv? | 36,716,554 | -2 | 72 | 67,525 | 0 | python,django,virtualenv | If it is going to be on the same path you can tar it and extract it on another machine. If all the same dependencies, libraries etc are available on the target machine it will work. | 0 | 0 | 0 | 0 | 2013-02-04T10:39:00.000 | 3 | -0.132549 | false | 14,684,968 | 1 | 0 | 1 | 1 | I'm new to virtualenv but I'm writting django app and finally I will have to deploy it somehow.
So lets assume I have my app working on my local virtualenv where I installed all the required libraries. What I want to do now, is to run some kind of script, that will take my virtualenv, check what's installed inside and ... |
Dynamically Generating Pretty Web Based Charts/Graphs | 14,691,588 | 1 | 1 | 262 | 0 | python,graph | I would recommend the awesome d3.js package, you can do just about anything with it and it produces beautiful interactive charts. | 0 | 0 | 0 | 0 | 2013-02-04T15:55:00.000 | 1 | 1.2 | true | 14,690,411 | 0 | 0 | 1 | 1 | I'm using Python to work on a web app that has a data visualization element. Basically, it will gather data about a user's music catalog and allow them to visualize it and take actions based on what the data tells them. I'll pretty much exclusively need bar graphs to achieve the visualization I want. Given the dynamic ... |
How can I integrate Tornado into my (currently) Apache driven site? | 14,700,450 | 1 | 0 | 956 | 0 | php,python,apache,localhost,tornado | Easiest is to run Tornado and Apache on different ports/addresses
So you probably have Apache listening to port 80 already. Tornado could listen to port 81
If the server is multihomed, you could have Apache listen to a.b.c.d:80 and Tornado listen to a.b.c.e:80. This means that you'll at least have to have the Apache pa... | 0 | 1 | 0 | 0 | 2013-02-05T04:37:00.000 | 1 | 1.2 | true | 14,700,305 | 0 | 0 | 1 | 1 | I have a website built in PHP and currently running on an Apache server (XAMPP locally). I would like to integrate a real-time chat system into the website. PHP and Apache not being geared for this in the slightest, I decided to work with Tornado and Python.
What is the easiest way to keep the base of the site in PHP ... |
Modules not found in django | 14,702,956 | 0 | 0 | 207 | 0 | python,django | what is the reason for nesting "data" app in "apps"? it is uncommon to nest one app inside of another when there are only two apps (unless you have some great reason to). suggestions:
create an apps app, and create a data model for it;
create an apps app, and a data app; (link them however through the models)
the answe... | 0 | 0 | 0 | 0 | 2013-02-05T05:45:00.000 | 1 | 0 | false | 14,700,943 | 0 | 0 | 1 | 1 | I want to make an application in django with two apps named apps and data.the "data" apps is placed within "apps".I had entered 'apps.data' in the Installed apps in "settings.py".when I run the devserver i got this error "no modules named apps.data".Any one please help me. |
How to monitor google app engine from command line? | 14,723,922 | 1 | 1 | 104 | 0 | python,google-app-engine | I assume you are using Linux, Ubuntu/Mint If not that would be a good start
Debug as much as you can locally using dev_appserver.py - this will display errors on start up (in the console)
Add your own debug logs when needed
Run code snippets in the interactive console - this is really useful to test snippets of code:
... | 0 | 1 | 0 | 0 | 2013-02-06T02:11:00.000 | 3 | 0.066568 | false | 14,720,476 | 0 | 0 | 1 | 1 | I'm starting to use Google App Engine and being a newcomer to much of the stuff going on here, I broke my webpage (all I see is "server error" in my web browser). I'd like to be able to see a console of some sort which is telling me what's going wrong (python syntax? file not found? something else?). Searching around a... |
Fastest way to do _simple_ templating with Python | 16,305,372 | 0 | 0 | 42 | 0 | python,performance,templating | After lots of trying and reading I found string.Template from the Core Library to be the fastest - I just wrapped in my own simple class to encapsulate the file-access/reads et voilà. | 0 | 0 | 0 | 1 | 2013-02-06T11:12:00.000 | 1 | 1.2 | true | 14,727,628 | 0 | 0 | 1 | 1 | After using cheetah and mako at their functional minimum (only for substitution) for sometime, I started asking myself whether just using string.Template wouldn't be the better and simpler approach for my use case(less deps).
In addition I wondered whether it would be reasonable to import these templates as .py files ... |
Django HTTP 500 Error | 14,732,094 | 1 | 9 | 19,790 | 0 | python,django,http,templates | Have you tried with another browser ? Is your custom error page larger than 512 bytes ? It seems some browsers (including Chrome) replace errors page with their own when the server's answer is shorter than 512 bytes. | 0 | 0 | 0 | 0 | 2013-02-06T14:55:00.000 | 4 | 0.049958 | false | 14,731,988 | 0 | 0 | 1 | 1 | I am creating a custom HTTP 500 error template. Why is it Django shows it when i raise an exception and not when I return HttpResponseServerError (I just get the default browser 500 error)? I find this behaviour strange... |
Django with Gunicorn different ways to deploy | 14,740,868 | 1 | 6 | 472 | 0 | python,django,nginx,gunicorn | Use gunicorn_django [OPTIONS] myproject if you use myproject.settings | 0 | 0 | 0 | 0 | 2013-02-06T17:44:00.000 | 1 | 1.2 | true | 14,735,464 | 0 | 0 | 1 | 1 | I've been reading about deploying Django with gunicorn and I wanted to give it a try.
I have found at least 3 ways of running a server with gunicorn and django:
gunicorn [OPTIONS] [APP_MODULE] # tested locally and worked fine
python managy.py run_gunicorn # also works fine locally
gunicorn_django [OPTIONS] [SETTINGS... |
Convert Java Google AppEngine app to Python AppEngine | 14,743,018 | 2 | 0 | 201 | 0 | java,python,google-app-engine | It'll be a complete rewrite.
However, the server side should be independent of the client. You can have a python client for the Raspberry Pi and your server side code can still be written in Java. | 0 | 1 | 0 | 0 | 2013-02-07T00:14:00.000 | 1 | 1.2 | true | 14,741,395 | 0 | 0 | 1 | 1 | I'm a big noob to GAE, moderate level in Python, and moderate-to-rusty in Java.
I am looking to convert an existing and working GAE Java app (in the Google Play store and runs on Android) into GAE Python.
The end goal is to get it into the Raspberry Pi Store, so I'm assuming GAE Python would be the most seamless.
Has a... |
Web2py vs django for beginner web programmer | 14,742,495 | 6 | 0 | 4,734 | 0 | python,django,web2py | I'm a beginner also. I started in about 8 months ago knowing no computer science, programming, powershell, or even html/css, and now I just about have a full django website ready, minus some minor issues because I need video and video is still above my head and hard to find info/learn about. Anyway, if you don't alrea... | 0 | 0 | 0 | 0 | 2013-02-07T01:02:00.000 | 2 | 1 | false | 14,741,824 | 0 | 0 | 1 | 1 | I am very interested in learning web programming.. I want to use something from python but not sure if I want to use web2py or django.. Django seems difficult to set up for a beginner such as myself.. But I do not want to throw it out just yet.. Soo what are some expert opinions on web programming frameworks? Also, if ... |
Django Text Formatting, Markup? Markdown? | 14,742,935 | 0 | 0 | 1,434 | 0 | python,django | You can have a look at CKEditor. | 0 | 0 | 0 | 0 | 2013-02-07T01:41:00.000 | 4 | 0 | false | 14,742,170 | 0 | 0 | 1 | 1 | I am very interested in using Django for creating a small travel blog for myself. There are a few reasons why I am more interested in using Django instead of something like Wordpress. One is that I am interested in having a grip on all the details and in the end creating something that doesn't look like a wordpress b... |
Caching in Django | 14,743,602 | 0 | 1 | 572 | 0 | python,django,caching | Yes, Memcached is the right answer. Just take time to do it. | 0 | 0 | 0 | 0 | 2013-02-07T04:14:00.000 | 3 | 0 | false | 14,743,431 | 0 | 0 | 1 | 1 | I need to implement some caching mechanism in my Python/Django project. Currently our live site is in Heroku cloud.
Which is the best caching mechanism to use i.e 'Local-memory caching' ,'Filesystem caching' or 'Database caching'? I need to easily implement this in our live heroku cloud environment. One of my friend s... |
How should our devs test python SVN branches with Jenkins? | 14,828,819 | 3 | 4 | 601 | 0 | python,svn,jenkins,continuous-integration,release | The question is a bit too big to be answered in a simple post, I will therefore try to give a few hints and references as far as I see from my personal view:
A few quick tips:
I like the idea of separating the developers into branches, but I would do the testing on the feature-branch and only merge to the beta branch ... | 0 | 0 | 0 | 1 | 2013-02-07T15:40:00.000 | 2 | 1.2 | true | 14,755,065 | 0 | 0 | 1 | 1 | I am working on a web project with 7 developers. I setup a beta box (debian) so that we can do testing of new code before passing it to staging.
On the beta box, I setup Jenkins and would like to automate the merge/testing process. We also have a test suite which I would like to tie-in somehow.
How should I test and ru... |
API to copy music to iPod | 14,756,354 | 5 | 1 | 258 | 0 | java,python,ipod | I believe the transfer protocol between iTunes and ipod is a closed one..and hence dont think there is a publicly available protocol. | 0 | 0 | 0 | 0 | 2013-02-07T16:40:00.000 | 2 | 0.462117 | false | 14,756,286 | 0 | 0 | 1 | 1 | Is there an API to copy music (files on disk) to an iPod?
Any language will do, but preferably Java or python. |
How to connect to a different database in OpenERP? | 14,796,657 | 1 | 1 | 1,877 | 1 | python,xml-rpc,openerp | One way to connect to an external application is to create a connector module. There are already several connector modules that you can take a look at:
the thunderbird and outlook plugins
the joomla and magento modules
the 'event moodle' module
For example, the joomla connector uses a joomla plugin to handle the comm... | 0 | 0 | 0 | 0 | 2013-02-07T16:45:00.000 | 1 | 0.197375 | false | 14,756,365 | 0 | 0 | 1 | 1 | How would one go about connecting to a different database based on which module is being used? Our scenario is as follows:
We have a standalone application with its own database on a certain server and OpenERP running on different server. We want to create a module in OpenERP which can utilise entities on the standalon... |
Psycopg missing module in Django | 15,337,328 | 1 | 2 | 1,586 | 1 | python,django,pip,psycopg2,psycopg | This was solved by performing a clean reinstall of django. There was apparently some dependecies missing that the recursive pip install did not seem to be able to solve. | 0 | 0 | 0 | 0 | 2013-02-07T18:10:00.000 | 2 | 1.2 | true | 14,758,024 | 0 | 0 | 1 | 1 | I have pip installed psycopg2, but when I try to runserver or syncdb in my Django project, it raises an error saying there is "no module named _psycopg".
EDIT: the "syncdb" command now raises:
django.core.exceptions.ImproperlyConfigured: ImportError django.contrib.admin: No module named _psycopg
Thanks for your help |
Django code changes not reflecting on production server | 14,770,990 | 2 | 11 | 6,659 | 0 | python,django,apache,caching,memcached | You have to restart your server (WSGI, UWSGI or whatever your use on production environment) | 0 | 0 | 0 | 0 | 2013-02-08T10:55:00.000 | 3 | 0.132549 | false | 14,770,972 | 0 | 0 | 1 | 1 | I changed a .py file and changes reflected on local dev. server for Django after deleting .pyc.
The production server does not even have .pyc for this specific file. Tried touching apache wsgi and restarting apache on prod. server but no luck.
Even deleting this .py file makes application work the same. There is memca... |
Keep Secret Keys Out | 53,798,521 | 2 | 29 | 26,432 | 0 | python,django,settings | Here's one way to do it that is compatible with deployment on Heroku:
Create a gitignored file named .env containing:
export DJANGO_SECRET_KEY = 'replace-this-with-the-secret-key'
Then edit settings.py to remove the actual SECRET_KEY and add this instead:
SECRET_KEY = os.environ['DJANGO_SECRET_KEY']
Then when you want... | 0 | 0 | 0 | 1 | 2013-02-09T07:49:00.000 | 7 | 0.057081 | false | 14,786,072 | 0 | 0 | 1 | 4 | One of the causes of the local_settings.py anti-pattern is that putting SECRET_KEY, AWS
keys, etc.. values into settings files has problem:
Secrets often should be just that: secret! Keeping them in version control means
that everyone with repository access has access to them.
My question is how to keep all keys as s... |
Keep Secret Keys Out | 14,786,575 | 6 | 29 | 26,432 | 0 | python,django,settings | Store your local_settings.py data in a file encrypted with GPG - preferably as strictly key=value lines which you parse and assign to a dict (the other attractive approach would be to have it as executable python, but executable code in config files makes me shiver).
There's a python gpg module so that's not a problem.... | 0 | 0 | 0 | 1 | 2013-02-09T07:49:00.000 | 7 | 1 | false | 14,786,072 | 0 | 0 | 1 | 4 | One of the causes of the local_settings.py anti-pattern is that putting SECRET_KEY, AWS
keys, etc.. values into settings files has problem:
Secrets often should be just that: secret! Keeping them in version control means
that everyone with repository access has access to them.
My question is how to keep all keys as s... |
Keep Secret Keys Out | 14,786,114 | 5 | 29 | 26,432 | 0 | python,django,settings | Ideally, local_settings.py should not be checked in for production/deployed server. You can keep backup copy somewhere else, but not in source control.
local_settings.py can be checked in with development configuration just for convenience, so that each developer need to change it.
Does that solve your problem? | 0 | 0 | 0 | 1 | 2013-02-09T07:49:00.000 | 7 | 0.141893 | false | 14,786,072 | 0 | 0 | 1 | 4 | One of the causes of the local_settings.py anti-pattern is that putting SECRET_KEY, AWS
keys, etc.. values into settings files has problem:
Secrets often should be just that: secret! Keeping them in version control means
that everyone with repository access has access to them.
My question is how to keep all keys as s... |
Keep Secret Keys Out | 46,735,039 | 0 | 29 | 26,432 | 0 | python,django,settings | You may need to use os.environ.get("SOME_SECRET_KEY") | 0 | 0 | 0 | 1 | 2013-02-09T07:49:00.000 | 7 | 0 | false | 14,786,072 | 0 | 0 | 1 | 4 | One of the causes of the local_settings.py anti-pattern is that putting SECRET_KEY, AWS
keys, etc.. values into settings files has problem:
Secrets often should be just that: secret! Keeping them in version control means
that everyone with repository access has access to them.
My question is how to keep all keys as s... |
Can I get the browser width and height in Pyramid? | 14,802,581 | 7 | 1 | 118 | 0 | python,pyramid | No, that is not possible to determine with server-side code only. Browsers do not share that information when making HTTP requests to the server.
You'll have to do this with JavaScript. | 0 | 0 | 0 | 1 | 2013-02-10T20:21:00.000 | 1 | 1.2 | true | 14,802,197 | 0 | 0 | 1 | 1 | Is it possible to get the user's browser width and height in Pyramid? I've searched through the response object and Googled.
If it's not available in Pyramid, I'll just grab it in javascript |
Matching contents of an html file with keyword python | 14,815,973 | 1 | 0 | 168 | 0 | python,html,compare,match | import urllib and use urllib.urlopen for getting the contents of an html. import re to search for the hash code using regex. You could also use find method on the string instead of regex.
If you encounter problems, then you can ask more specific questions. Your question is too general. | 0 | 0 | 1 | 0 | 2013-02-11T15:59:00.000 | 2 | 1.2 | true | 14,815,856 | 0 | 0 | 1 | 1 | I am making a download manager. And I want to make the download manager check the md5 hash of an url after downloading the file. The hash is found on the page. It needs to compute the md5 of the file ( this is done), search for a match on the html page and then compare the WHOLE contents of the html page for a match.
m... |
Python with xampp | 14,820,176 | 0 | 0 | 89 | 0 | python,apache | you need Choose a web framework. CherryPy. Pylons. Django. | 0 | 0 | 0 | 0 | 2013-02-11T20:15:00.000 | 1 | 1.2 | true | 14,820,071 | 0 | 0 | 1 | 1 | I want to create a .py file and display simple html code, just like I simply open any php file. I've put file.py inside of the c:/xampp/cgi-bin directory, I've enagled .py extension in apache configs, but...am I doing this the right way? What next?
How to open this file? localhost/cgi-bin/file.py displays the internal ... |
Using Amazon SWF To communicate between servers | 14,829,925 | 1 | 9 | 3,687 | 0 | python,linux,amazon-web-services,boto,amazon-swf | You can use SNS,
When script A is completed it should trigger SNS, and that will trigger a notification to Server B | 0 | 0 | 1 | 0 | 2013-02-12T09:44:00.000 | 4 | 0.049958 | false | 14,829,562 | 0 | 0 | 1 | 2 | Use Amazon SWF to communicate messages between servers?
On server A I want to run a script A
When that is finished I want to send a message to server B to run a script B
If it completes successfully I want it to clear the job from the workflow queue
I’m having a really hard time working out how I can use Boto and S... |
Using Amazon SWF To communicate between servers | 14,881,688 | 5 | 9 | 3,687 | 0 | python,linux,amazon-web-services,boto,amazon-swf | I don't have any example code to share, but you can definitely use SWF to coordinate the execution of scripts across two servers. The main idea with this is to create three pieces of code that talk to SWF:
A component that knows which script to execute first and what to do once that first script is done executing. T... | 0 | 0 | 1 | 0 | 2013-02-12T09:44:00.000 | 4 | 0.244919 | false | 14,829,562 | 0 | 0 | 1 | 2 | Use Amazon SWF to communicate messages between servers?
On server A I want to run a script A
When that is finished I want to send a message to server B to run a script B
If it completes successfully I want it to clear the job from the workflow queue
I’m having a really hard time working out how I can use Boto and S... |
Shopify Python API: How do I add a product to a collection? | 56,934,353 | 0 | 1 | 4,023 | 0 | python,django,api,shopify | The documentation is again not promising but one thing to bear in mind is that there should in actual fact be an existing collection already created
Find it by using this code
collection_id = shopify.CustomCollection.find(handle=<your_handle>)[0].id
then consequently add the collection_id, product_id to a Collect objec... | 0 | 0 | 0 | 0 | 2013-02-13T03:30:00.000 | 3 | 0 | false | 14,845,942 | 0 | 0 | 1 | 1 | I am using the Shopify Python API in an django app to interact with my Shopify Store.
I have a collection - called - best sellers.
I am looking to create a batch update to this collection - that is add/remove products to this collection. However, they python API docs does not seem to say much about how to do so. How d... |
How to include third party Python libraries in Google App Engine? | 14,850,874 | 0 | 33 | 23,439 | 0 | python,google-app-engine | Just put Beautifulsoup in the root of your project and upload it all | 0 | 1 | 0 | 0 | 2013-02-13T10:01:00.000 | 6 | 0 | false | 14,850,853 | 0 | 0 | 1 | 2 | How to add third party python libraries in Google App Engine, which are not provided by Google? I am trying to use BeautifulSoup in Google App Engine and unable to do so. But my question is for any library I want to use in Google App Engine. |
How to include third party Python libraries in Google App Engine? | 35,193,844 | 0 | 33 | 23,439 | 0 | python,google-app-engine | pip install -t lib package_name
lib: the location for third party libraries
Then you are good to use this package like a normal library you use from ipython or terminal. | 0 | 1 | 0 | 0 | 2013-02-13T10:01:00.000 | 6 | 0 | false | 14,850,853 | 0 | 0 | 1 | 2 | How to add third party python libraries in Google App Engine, which are not provided by Google? I am trying to use BeautifulSoup in Google App Engine and unable to do so. But my question is for any library I want to use in Google App Engine. |
Python script handler for Google AppEngine | 14,868,496 | 2 | 0 | 100 | 0 | python,google-app-engine,urlfetch,app.yaml | The myScript.py was for the 2.5 runtime, the model for invoking apps with 2.7 runtime normally utilises the myScript.app method. Have a look at the age of the tutorials and also what Python runtime they have configured in their app.yaml. | 0 | 1 | 0 | 0 | 2013-02-14T04:44:00.000 | 1 | 0.379949 | false | 14,867,945 | 0 | 0 | 1 | 1 | I am writing an app engine application to fetch url content using urlfetch available in google app engine.
however in the app.yaml file, I have a doubt in script handle
I have found that some people use script name as myScript.py while some tutorials use myScript.app
what's the difference between the two uses ? |
Crawling a page using LazyLoader with Python BeautifulSoup | 16,251,642 | 1 | 3 | 1,587 | 0 | python,python-2.7,lazy-loading,beautifulsoup | It turns out that the problem itself wasn't BeautifulSoup, but the dynamics of the page itself. For this specific scenario that is.
The page returns part of the page, so headers need to be analysed and sent to the server accordingly. This isn't a BeautifulSoup problem itself.
Therefore, it is important to take a look... | 0 | 0 | 1 | 0 | 2013-02-14T04:49:00.000 | 1 | 1.2 | true | 14,868,003 | 0 | 0 | 1 | 1 | I am toying around with BeautifulSoup and I like it so far.
The problem is the site I am trying to scrap has a lazyloader... And it only scraps one part of the site.
Can I have a hint as to how to proceed? Must I look at how the lazyloader is implemented and parametrize anything else? |
postgres : relation there even after dropping the database | 14,880,796 | 1 | 0 | 88 | 1 | python,django,postgresql | Most likely somewhere along the line, you created your objects in the template1 database (or in older versions the postgres database) and every time you create a new db i thas all those objects in it. You can either drop the template1 / postgres database and recreate it or connect to it and drop all those objects by h... | 0 | 0 | 0 | 0 | 2013-02-14T07:23:00.000 | 2 | 0.099668 | false | 14,869,718 | 0 | 0 | 1 | 2 | I dropped my database that I had previously created for django using :
dropdb <database>
but when I go to the psql prompt and say \d, I still see the relations there :
How do I remove everything from postgres so that I can do everything from scratch ? |
postgres : relation there even after dropping the database | 14,870,374 | 0 | 0 | 88 | 1 | python,django,postgresql | Chances are that you never created the tables in the correct schema in the first place. Either that or your dropdb failed to complete.
Try to drop the database again and see what it says. If that appears to work then go in to postgres and type \l, putting the output here. | 0 | 0 | 0 | 0 | 2013-02-14T07:23:00.000 | 2 | 0 | false | 14,869,718 | 0 | 0 | 1 | 2 | I dropped my database that I had previously created for django using :
dropdb <database>
but when I go to the psql prompt and say \d, I still see the relations there :
How do I remove everything from postgres so that I can do everything from scratch ? |
decoder zip not available (Windows 7) | 24,042,390 | 2 | 4 | 1,765 | 0 | django,python-imaging-library | I was able to solve this cleanly on Windows with pip install --use-wheel Pillow. I'm not sure what changed because the PILLOW installs used to work on my windows setup. I must have some mixed versions or the default behaviors have changed. | 0 | 0 | 0 | 0 | 2013-02-14T09:22:00.000 | 3 | 0.132549 | false | 14,871,454 | 1 | 0 | 1 | 1 | I installed django-photologue. But then when I try to save a photo in django admin it throws this error:
'decoder zip not available'
I have already un-installed and re-installed PIL. I hope someone can help me with the complete steps on how to overcome this error. |
How should I establish and manage database connections in a multi-module Python app? | 14,883,719 | 4 | 17 | 6,022 | 1 | python,mysql | MySQL connections are relatively fast, so this might not be a problem (i.e. you should measure). Most other databases take much more resources to create a connection.
Creating a new connection when you need one is always the safest, and is a good first choice. Some db libraries, e.g. SqlAlchemy, have connection pools ... | 0 | 0 | 0 | 0 | 2013-02-14T20:20:00.000 | 2 | 0.379949 | false | 14,883,346 | 0 | 0 | 1 | 2 | We have a Python application with over twenty modules, most of which are shared by several web and console applications.
I've never had a clear understanding of the best practice for establishing and managing database connection in multi module Python apps. Consider this example:
I have a module defining an object cla... |
How should I establish and manage database connections in a multi-module Python app? | 14,883,590 | 16 | 17 | 6,022 | 1 | python,mysql | The best method is to open a connection when you need to do some operations (like getting and/or updating data); manipulate the data; write it back to the database in one query (very important for performance), and then close the connection. Opening a connection is a fairly light process.
Some pitfalls for performan... | 0 | 0 | 0 | 0 | 2013-02-14T20:20:00.000 | 2 | 1.2 | true | 14,883,346 | 0 | 0 | 1 | 2 | We have a Python application with over twenty modules, most of which are shared by several web and console applications.
I've never had a clear understanding of the best practice for establishing and managing database connection in multi module Python apps. Consider this example:
I have a module defining an object cla... |
Checking if a user disconnects using Flask | 14,915,333 | 2 | 1 | 1,304 | 0 | python,flask | Basically you can't tell that the user has left your site on the server-side. The common way to do what you want to achieve is to use a time limit after the last known request as a cutoff between the online/offline states.
To make this more accurate you can have a script on the client-side that does regular AJAX polli... | 0 | 0 | 1 | 0 | 2013-02-15T00:13:00.000 | 1 | 1.2 | true | 14,886,400 | 0 | 0 | 1 | 1 | I am trying to check if a user disconnects from my site, how would I go about doing this?
I am doing this in order to check if a user is "online" or not. |
socketio in python | 14,888,521 | 0 | 0 | 475 | 0 | django,python-2.7,socket.io,gevent,gevent-socketio | I think what you want is from socketio.server import SocketIOServer | 0 | 0 | 1 | 0 | 2013-02-15T04:49:00.000 | 2 | 0 | false | 14,888,428 | 0 | 0 | 1 | 2 | Kindly help me in configuring the socketio in my django module. Am using windows7 OS
File wsgi.py
Sample Code - from socketio import SocketIOServer
Error - Unresolved import:SocketIOServer
Am new to python and Django Frameworks.! |
socketio in python | 53,155,835 | 1 | 0 | 475 | 0 | django,python-2.7,socket.io,gevent,gevent-socketio | Try this:
pip install socketIO-server | 0 | 0 | 1 | 0 | 2013-02-15T04:49:00.000 | 2 | 0.099668 | false | 14,888,428 | 0 | 0 | 1 | 2 | Kindly help me in configuring the socketio in my django module. Am using windows7 OS
File wsgi.py
Sample Code - from socketio import SocketIOServer
Error - Unresolved import:SocketIOServer
Am new to python and Django Frameworks.! |
How can I open two log files in one HTML page in Django? | 14,888,883 | 0 | 2 | 282 | 0 | python,linux,django,django-class-based-views | Create a new view in Django
in the controller, import os
use lastLines = os.popen("tail /path/to/logFile").read()
show these listLines in the view | 0 | 0 | 0 | 0 | 2013-02-15T05:33:00.000 | 2 | 0 | false | 14,888,843 | 0 | 0 | 1 | 1 | I have my two log files in my django root dir called apache.error.log and django.log. In my app/static folder I have the HTML file mylog.html. Now I want to view those log files inside that HTML page.
Is this possible? I want to view the last 20 lines of both files. basically something like tail -f, but inside the brow... |
Search engine from scratch | 14,889,522 | 3 | 0 | 643 | 1 | python,mysql,search,search-engine | The best bet for you to do "Search Engine" for the 10,000 Articles is to read "Programming Collective Intelligence" by Toby Segaran. Wonderful read and to save your time go to Chapter 4 of August 2007 issue. | 0 | 0 | 0 | 0 | 2013-02-15T06:10:00.000 | 2 | 0.291313 | false | 14,889,206 | 0 | 0 | 1 | 1 | I have a MySQL database with around 10,000 articles in it, but that number will probably go up with time. I want to be able to search through these articles and pull out the most relevent results based on some keywords. I know there are a number of projects that I can plug into that can essentially do this for me. Howe... |
Django: how to make STATIC_URL empty? | 14,902,498 | 1 | 2 | 294 | 0 | python,django | I believe this is not supported out of the box. Off the top of my head, one way to do it would be with a special 404 handler that, having failed to match against any of the defined URLs, treats the request as a request for a static resource. This would be reasonably easy to do in the development environment but signifi... | 0 | 0 | 0 | 0 | 2013-02-15T19:34:00.000 | 2 | 0.099668 | false | 14,902,023 | 0 | 0 | 1 | 1 | Yep, I want it to work like in Flask framework - there I could set parameters like this:
static_folder=os.getcwd()+"/static/", static_url_path=""
and all the files that lies in ./static/files/blabla.bla would be accessible by mysite.com/files/blabla.bla address. I really don't want to add static after mysite.com.
But i... |
How large data can memcached handle efficiently? | 14,907,596 | 2 | 1 | 2,162 | 0 | python,django,caching,memcached | Memcached is more or less only limited by available (free) memory in the number of servers you run it on. The more memory, the more data fits, and since it uses fairly efficient in-memory indexes, you won't really see performance degrade in any significant way with more objects.
Remember though, it's a cache and there ... | 0 | 0 | 0 | 0 | 2013-02-16T05:56:00.000 | 2 | 0.197375 | false | 14,907,457 | 0 | 0 | 1 | 1 | How large values can I store and retrieve from memcached without degrading its performance?
I am using memcached with python-memcached in a django based web application. |
Is there a Python Memcached library with support for AWS ElastiCache's auto-discovery feature? | 14,924,764 | 1 | 2 | 2,949 | 0 | python,memcached,amazon-elasticache | As far as I know, ElastiCache cluster is just a bunch of memcached servers, so you need to give your memcached client the list of all of your servers and have the client do the relevant load balancing.
For Python, you have a couple of options:
pylibmc - which is a wrapper around libmemcached - one of the best and fast... | 0 | 1 | 0 | 0 | 2013-02-17T18:35:00.000 | 3 | 1.2 | true | 14,924,586 | 0 | 0 | 1 | 1 | Recently, AWS announced ElastiCache's auto-discovery feature, although they only officially released a client for Java. Does anyone know of a Python Memcached library with support for this feature? |
find django/contrib/admin/templates | 14,931,827 | 0 | 14 | 15,440 | 0 | python,django,ubuntu,django-templates | Should be here: /usr/lib/python2.7/site-packages/django/contrib/admin/templates | 0 | 0 | 0 | 0 | 2013-02-18T08:04:00.000 | 6 | 0 | false | 14,931,793 | 0 | 0 | 1 | 3 | I have trouble to see django/contrib/admin/templates folder. It seems like it is hidden in /usr/lib/python2.7/dist-packages/ folder, ctrl+h wont help ( appearencely all django files are hidden).
"locate django/contrib/admin/templates" in terminal shows bunch of files, but how can i see those files in GUI? I use Ubuntu ... |
find django/contrib/admin/templates | 14,931,847 | 0 | 14 | 15,440 | 0 | python,django,ubuntu,django-templates | Since, everyone is posting my comment's suggestion, might as well post it myself. Try looking at:
/usr/lib/python2.6/site-packages/django/ | 0 | 0 | 0 | 0 | 2013-02-18T08:04:00.000 | 6 | 0 | false | 14,931,793 | 0 | 0 | 1 | 3 | I have trouble to see django/contrib/admin/templates folder. It seems like it is hidden in /usr/lib/python2.7/dist-packages/ folder, ctrl+h wont help ( appearencely all django files are hidden).
"locate django/contrib/admin/templates" in terminal shows bunch of files, but how can i see those files in GUI? I use Ubuntu ... |
find django/contrib/admin/templates | 53,451,127 | 0 | 14 | 15,440 | 0 | python,django,ubuntu,django-templates | If you are using Python3, Django is located at your venv. In my case templates are located at <project_root>/venv/lib/python3.5/site-packages/django/contrib/admin/templates/. | 0 | 0 | 0 | 0 | 2013-02-18T08:04:00.000 | 6 | 0 | false | 14,931,793 | 0 | 0 | 1 | 3 | I have trouble to see django/contrib/admin/templates folder. It seems like it is hidden in /usr/lib/python2.7/dist-packages/ folder, ctrl+h wont help ( appearencely all django files are hidden).
"locate django/contrib/admin/templates" in terminal shows bunch of files, but how can i see those files in GUI? I use Ubuntu ... |
conditional xpath? need xpath if more specific xpath is matched | 14,946,219 | 0 | 0 | 153 | 0 | python,xpath | You could do the matching in XPath, and then simply take the resulting nodes parent in Python. | 0 | 0 | 1 | 0 | 2013-02-18T20:39:00.000 | 3 | 0 | false | 14,944,900 | 0 | 0 | 1 | 1 | I'm trying to create a list of dicts with two data items.
The page I'm looking at has 37 matches for //div[@id='content']/*[self::p or self::h2]/a[2]; however, it only has 33 matches for
//div[@id='content']/*[self::p or self::h2]/a[contains(@href,'game')]/img[@src]
The two xpaths have //div[@id='content']/*[self::p o... |
How to disable Google App Engine python SDK import hook? | 14,950,038 | 0 | 1 | 158 | 0 | python,google-app-engine | Easiest thing is to modify google/appengine/tools/dev_appserver_import_hook.py and add the module you want to the whitelist.
This will allow you to import whatever you want.
Now there's a good reason that the imports are restricted in the development server. The restricted imports match what's available on the product... | 0 | 1 | 0 | 0 | 2013-02-19T00:35:00.000 | 1 | 0 | false | 14,947,860 | 0 | 0 | 1 | 1 | I am playing around with local deployment of GAE python SDK. The code that I am trying to run contains many external libraries which are not part of GAE import whitelist. I want to disable the import restrictions and let GAE app import any locally installed module.
After walking through the code, I figured out that th... |
Django 1.5 custom user model plus admin.autodiscover() breaks app | 14,964,876 | 1 | 1 | 1,388 | 0 | python,django,django-admin,django-authentication | I set up a brand new empty project with a custom user model and attempted to recreate the situation, which led to a diagnosis: we had added the django-usertools package to the project, which has not been updated for Django 1.5 and apparently conflicts with custom user models. Removing that package from the installed a... | 0 | 0 | 0 | 0 | 2013-02-19T02:28:00.000 | 2 | 1.2 | true | 14,948,810 | 0 | 0 | 1 | 1 | I have a custom user model (it's actually named User as I didn't see any need to name it otherwise) in my Django 1.5c1 project (currently running on the latest from the Django 1.5 branch on github). AUTH_USER_MODEL is defined in my settings properly, so the auth module works correctly and I can log in etc. fine.
Howev... |
Installing Pyramid without the template systems (Mako and Chameleon) | 14,950,809 | 2 | 1 | 314 | 0 | python,pyramid | There is a project to eventually remove those templating dependancies and make them available as separate packages. The work started at last year pycon sprints and can be continued this year, who knows. OTOH having those packages installed in your venv doesn't really affect your app so just avoid using them and only us... | 0 | 0 | 0 | 1 | 2013-02-19T03:57:00.000 | 1 | 0.379949 | false | 14,949,586 | 0 | 0 | 1 | 1 | Is there a "good way" to install Pyramid without the templating systems? The templating systems I speak of are Mako and Chameleon. In Single Page Applications (SPA) there is very little need for server-side templating since all of the templates are rendered on the client-side with javascript. I like the power of Pyrami... |
need assisstance to set python2.7 as default & Django to install | 14,955,895 | 1 | 0 | 143 | 0 | linux,django,python-2.7,centos | Your CentOS relies on python 2.4 so that's not going to work. You should probably create a new system user and install pyton 2.7 in its home directory (or use your root user and install python in /opt for global usage), you can find plenty of tutorials on Google.
After succesfully doing so, you can set an alias in your... | 0 | 1 | 0 | 0 | 2013-02-19T10:43:00.000 | 1 | 1.2 | true | 14,955,468 | 0 | 0 | 1 | 1 | I am not able to install Django.I am using CentOS 5,not able to set python2.7 environment variable.Priviously in my system python2.4.3 is available,but after installing python 2.7 in the terminal i checked the version avail in system using "python -V"cmd it executed as python 2.4.3.But if i checked using "python2.7 -V"... |
Learning Django unit testing | 14,961,957 | 0 | 2 | 311 | 0 | python,django,unit-testing | Did you try core developer Karen Tracy's book Django 1.1 Testing And Debugging? Although the title implies it's out of date, most of the advice is still applicable. | 0 | 0 | 0 | 1 | 2013-02-19T15:29:00.000 | 3 | 0 | false | 14,961,151 | 0 | 0 | 1 | 1 | I'm trying to get caught up on unit testing, and I've looked over a few books - Debugging Django, Web Dev. with Django, and the official docs, but none seem to cover unit testing thoroughly enough for me. I'm also not an expert in Python web development, so maybe that's why.
What I'm looking for is something that start... |
Running a script on EC2 start and stop | 14,966,165 | 1 | 1 | 1,561 | 0 | python,linux,amazon-web-services,amazon-ec2,amazon-rds | It is possible. You just have to write an init script and setup proper symbolic links in /etc/rc#.d directories. It will be started with a parameter start or stop depending on if machine is starting up or shutting down. | 0 | 1 | 1 | 1 | 2013-02-19T16:26:00.000 | 1 | 1.2 | true | 14,962,414 | 0 | 0 | 1 | 1 | I have an Amazon Ubuntu instance which I stop and start (not terminate). I was wondering if it is possible to run a script on start and stop of the server. Specifically, I am looking at writting a python boto script to take my RDS volume offline when the EC2 server is not running.
Can anyone tell me if this is possible... |
Retranslation audio stream with python on Google App Engine | 14,964,896 | 1 | 1 | 193 | 0 | python,google-app-engine,audio-streaming | You can't make long running external calls with App Engine. Maximum deadline (task queue and cron job handler) for UrlFetch is 10 minutes. So, I think it is not possible. | 0 | 1 | 0 | 0 | 2013-02-19T18:25:00.000 | 1 | 1.2 | true | 14,964,717 | 0 | 0 | 1 | 1 | I have a URL address to the audio stream, how I can retranslate it in the web with my address (myapp.appspot.com)?
Let me explain why I need it:
I have a very narrow channel, and will not stand many connections, so I have to do it with GAE
Thanks! |
Why django and python MySQLdb have one cursor per database? | 15,328,753 | 10 | 6 | 1,351 | 1 | python,mysql,django,mysql-python | A shorter answer would be, "MySQL doesn't support that type of cursor", so neither does Python-MySQL, so the reason one connection command is preferred is because that's the way MySQL works. Which is sort of a tautology.
However, the longer answer is:
A 'cursor', by your definition, would be some type of object access... | 0 | 0 | 0 | 0 | 2013-02-20T17:27:00.000 | 3 | 1.2 | true | 14,986,129 | 0 | 0 | 1 | 3 | Example scenario:
MySQL running a single server -> HOSTNAME
Two MySQL databases on that server -> USERS , GAMES .
Task -> Fetch 10 newest games from GAMES.my_games_table , and fetch users playing those games from USERS.my_users_table ( assume no joins )
In Django as well as Python MySQLdb , why is having one cursor f... |
Why django and python MySQLdb have one cursor per database? | 15,302,237 | 2 | 6 | 1,351 | 1 | python,mysql,django,mysql-python | As you say, MySQL connections are cheap, so for your case, I'm not sure there is a technical advantage either way, outside of code organization and flow. It might be easier to manage two cursors than to keep track of which database a single cursor is currently talking to by painstakingly tracking SQL 'USE' statements. ... | 0 | 0 | 0 | 0 | 2013-02-20T17:27:00.000 | 3 | 0.132549 | false | 14,986,129 | 0 | 0 | 1 | 3 | Example scenario:
MySQL running a single server -> HOSTNAME
Two MySQL databases on that server -> USERS , GAMES .
Task -> Fetch 10 newest games from GAMES.my_games_table , and fetch users playing those games from USERS.my_users_table ( assume no joins )
In Django as well as Python MySQLdb , why is having one cursor f... |
Why django and python MySQLdb have one cursor per database? | 15,421,235 | 0 | 6 | 1,351 | 1 | python,mysql,django,mysql-python | One cursor per database is not necessarily preferable, it's just the default behavior.
The rationale is that different databases are more often than not on different servers, use different engines, and/or need different initialization options. (Otherwise, why should you be using different "databases" in the first place... | 0 | 0 | 0 | 0 | 2013-02-20T17:27:00.000 | 3 | 0 | false | 14,986,129 | 0 | 0 | 1 | 3 | Example scenario:
MySQL running a single server -> HOSTNAME
Two MySQL databases on that server -> USERS , GAMES .
Task -> Fetch 10 newest games from GAMES.my_games_table , and fetch users playing those games from USERS.my_users_table ( assume no joins )
In Django as well as Python MySQLdb , why is having one cursor f... |
JavaBean equivalent in Python | 14,989,253 | 1 | 23 | 15,017 | 0 | java,python,javabeans | Implements serializable.
Pick your favorite format, and write a function that will serialize it for you. JSON, Pickle, YAML, any work. Just decide!
Has getters and setters -> private properties
We don't do that here, those are attributes of bondage languages, we are all adults in this language.
dummy constructor
A... | 0 | 0 | 0 | 0 | 2013-02-20T20:16:00.000 | 5 | 0.039979 | false | 14,989,100 | 1 | 0 | 1 | 1 | I am fairly new to using Python as a OOP. I am coming from a Java background. How would you write a javabean equivalent in python? Basically, I need a class that:
Implements serializable.
Has getters and setters -> private properties
dummy constructor
Any inputs? I am looking for a sample code! |
Django forms: get the value of a forms.CharField as a date | 14,991,863 | 1 | 1 | 1,270 | 0 | python,django,forms,date,callback | Why not just DateField instead? | 0 | 0 | 0 | 0 | 2013-02-20T22:17:00.000 | 2 | 0.099668 | false | 14,991,002 | 0 | 0 | 1 | 1 | I have a form that has a CharField input for an european date.
I need to transform it to a date python object.
Is there a way to let the form care about it, in the validation? some callback?
I don't want to do it in the view when there's the form processing. |
Django as a mysql proxy server? | 14,992,070 | 1 | 3 | 377 | 1 | c++,python,mysql,c,django | This is a completely valid concern and a very common problem. You have described creating a RESTful API. I guess it could be considered a proxy to a database but is not usually referred to as a proxy.
Django is a great tool to use to use to accomplish this. Django even has a couple packages that will assist in speed... | 0 | 0 | 0 | 0 | 2013-02-20T23:21:00.000 | 1 | 1.2 | true | 14,991,783 | 0 | 0 | 1 | 1 | I'm in the process of building a Django powered site that is backed by a MySQL server. This MySQL server is going to be accessed from additional sources, other than the website, to read and write table data; such as a program that users run locally which connects to the database.
Currently the program running locally i... |
Automatic Zabbix -> Confluence, creating too many updates | 15,069,936 | 0 | 0 | 412 | 0 | python,string-comparison,confluence,zabbix | This might not be the solution you are looking for, but you could have the updates generate an external html page and then use an {html-include} in confluence. So the confluence pages wouldn't be updated, but their displayed content would be correct.
The problem with this is that none of the confluence pages would be u... | 0 | 0 | 0 | 1 | 2013-02-21T08:12:00.000 | 1 | 0 | false | 14,997,400 | 0 | 0 | 1 | 1 | I have a python script that runs once a day, connects to our Zabbix monitoring database and pulls out all the active monitoring checks and documents them into Confluence.
My problem is that each hosts' confluence page gets updated every time the script runs, even if the monitoring hasn't changed.
A quick hack would be ... |
Sublime Editor Tree View | 15,007,333 | 1 | 1 | 1,374 | 0 | javascript,python,json,sublimetext2 | I don't know about tree-views but with jsFormat you can get a nice format of the json-object, basically a pretty-print.
The if you'd like to get advanced, and your JSON contains a lot of objects you can always use code-folding. Although this doesn't work very well with arrays (it will fold the complete json for me atl... | 0 | 0 | 0 | 0 | 2013-02-21T13:28:00.000 | 1 | 0.197375 | false | 15,003,487 | 0 | 0 | 1 | 1 | Is it possible to create a tree view for arbitrary data (JSON) as a plugin for Sublime Editor. I like working with javascript, and don't like having to switch to my firefox console to inspect objects.
Is there an existing plugin/solution?
Is it possible for me to make my own - can a tree view be displayed in Sublime Ed... |
Even though the Google Sites API creates a site, we cannot still access the site | 15,004,843 | 0 | 1 | 103 | 0 | python,google-app-engine,google-sites | I think you can try to reach Google API's developers to tell them about this bug, they might not be aware of it. | 0 | 0 | 1 | 0 | 2013-02-21T14:30:00.000 | 1 | 0 | false | 15,004,797 | 0 | 0 | 1 | 1 | I m using Google Sites API in my python code deployed over Google App Engine.
I have came across a problem: Google Sites API allows to create a site, add users to site(access permission),etc.., however we get status:200 form the API that site is being created and same for adding users to the Google Site, but when i go ... |
Why do languages like Java distinguish between string and char while others do not? | 15,010,424 | 4 | 7 | 1,089 | 0 | java,python,ruby,string,char | Bottom line is that is just how the language designer decided to make it. It's hard to get too much further than that.
However, one point about C, which is generally considered a lower-level language in that the syntax more accurately reflects the nature of the data and tasks being performed. Treating a character as a ... | 0 | 0 | 0 | 0 | 2013-02-21T19:10:00.000 | 5 | 0.158649 | false | 15,010,360 | 1 | 0 | 1 | 2 | I've noticed that languages like Java have a char primitive and a string class. Other languages like Python and Ruby just have a string class. Those languages instead use a string of length 1 to represent a character.
I was wondering whether that distinction was because of historical reasons. I understand the language ... |
Why do languages like Java distinguish between string and char while others do not? | 15,010,789 | 1 | 7 | 1,089 | 0 | java,python,ruby,string,char | I wasn't sure whether that distinction was because of historical
reasons (C only has chars, strings are formed with char* or char[]) or
if there was an actual purpose for doing it that way. I'm also curious
if one way has an advantage over another in certain situations.
In C the concept of a "string" is a charac... | 0 | 0 | 0 | 0 | 2013-02-21T19:10:00.000 | 5 | 0.039979 | false | 15,010,360 | 1 | 0 | 1 | 2 | I've noticed that languages like Java have a char primitive and a string class. Other languages like Python and Ruby just have a string class. Those languages instead use a string of length 1 to represent a character.
I was wondering whether that distinction was because of historical reasons. I understand the language ... |
How to handle refactor with south (django)? | 15,026,416 | 0 | 2 | 118 | 0 | python,database,django,migration,django-south | Make the changes to your models then run python manage.py schemamigration yourapp --auto. This will create the migrations for you (you'll see a new file in your migrations directory every time you do this process).
Sometimes you really need to edit a migration manually, but you should try and avoid it. Particularly if... | 0 | 0 | 0 | 0 | 2013-02-22T14:19:00.000 | 1 | 1.2 | true | 15,026,230 | 0 | 0 | 1 | 1 | I have installed south and make some migrations. Now there's a 'migrations' directory in the folder app. My question is: when I am refactoring models, which entries in the migration directory files I must apply the changes? I think some entries are related directly with the database schema, and others with the code its... |
Is there a way to efficiently create Python objects from outside of Python? | 15,027,654 | 8 | 0 | 65 | 0 | python | The best answer is to use a standardized format, such as JSON, and write up something to create the objects from that format in Python, and produce the data from Java. For simple things, this will be virtually no effort, but naturally, it'll scale up.
Trying to emulate pickle from within Java will be more effort than i... | 0 | 0 | 0 | 1 | 2013-02-22T15:32:00.000 | 1 | 1 | false | 15,027,601 | 1 | 0 | 1 | 1 | I want to create a serialized Python object from outside of Python (in this case, from Java) in such a way that Python can read it and treat it as if it were an object in Python. I'll start with simpler objects (int, float, String, and so on) but I'd love to know if this can be done with classes as well.
Functionality ... |
another transaction already in progress | 15,033,087 | 5 | 2 | 3,012 | 0 | python,google-app-engine | appcfg.py rollback C:\path\to\my\app is the required command.
If you are using Java, the rollback command is same as above, but the path to the application should be to the application's target directory. Otherwise, rollback will fail. | 0 | 1 | 0 | 0 | 2013-02-22T16:54:00.000 | 1 | 1.2 | true | 15,029,252 | 0 | 0 | 1 | 1 | I am using app engine launcher in windows and for some reason the last time i deployed my app, the transaction wouldn't finish, and now every time i try to deploy i get the error
another transaction by user is already in progress for app: s~ myapp, version 1
i have tried doing appcfg.py rollback, which brings up a py... |
Converting postgresql timestamp to JavaScript timestamp in Python | 15,032,100 | 3 | 8 | 4,296 | 1 | javascript,python,postgresql,flot | You can't send a Python or Javascript "datetime" object over JSON. JSON only accepts more basic data types like Strings, Ints, and Floats.
The way I usually do it is send it as text, using Python's datetime.isoformat() then parse it on the Javascript side. | 0 | 0 | 0 | 0 | 2013-02-22T19:33:00.000 | 2 | 0.291313 | false | 15,031,856 | 0 | 0 | 1 | 1 | I have a postgre database with a timestamp column and I have a REST service in Python that executes a query in the database and returns data to a JavaScript front-end to plot a graph using flot.
Now the problem I have is that flot can automatically handle the date using JavaScript's TIMESTAMP, but I don't know how to c... |
Python on the AWS Beanstalk. How to snapshot custom logs? | 15,183,303 | 6 | 15 | 5,607 | 0 | python,logging,amazon-elastic-beanstalk | If you need have ability to snapshot log files from Beanstalk management console, you should just write you log files to "/opt/python/log/" folder. Elastic beanstalk scripts use this folder for log tailing. | 0 | 1 | 0 | 0 | 2013-02-23T07:12:00.000 | 2 | 1.2 | true | 15,038,135 | 0 | 0 | 1 | 1 | I'm developing python application which works on aws beanstalk environment. For error handling and debugging proposes I write logs to custom lof file on the directory /var/logs/.
What should I do in order to have ability snapshot logs from Elastic beanstalk management console? |
Model added by south migration doesn't show in production admin site | 15,061,466 | 0 | 1 | 165 | 0 | python,django,uwsgi | After some pdb play-around I finally located the problem. It's about permissions. I set the permissions differently on my dev and production databases -- I am a superuser using the dev database, but only a staff on the production database, for whatever reason. The new model I added had its permission set to only visibl... | 0 | 0 | 0 | 0 | 2013-02-23T08:06:00.000 | 1 | 0 | false | 15,038,509 | 0 | 0 | 1 | 1 | I'm trying to add a new model to an pre-existed app on my production site with the following steps:
Adding a model
Add admin.site.register(<ModelName>) in the app's admin.py
./manage.py schemamigration <appname> --auto
./manage.py migrate <appname>
The above steps work on my dev machine (with SQLite3), so I continu... |
Multiple permissions in view_config decorator? | 15,057,901 | 5 | 10 | 1,193 | 0 | python,web-applications,permissions,security,pyramid | Make a readwrite permission. Each view gets one and only one permission but each principal can be mapped to many permissions. | 0 | 0 | 0 | 0 | 2013-02-24T18:27:00.000 | 1 | 1.2 | true | 15,055,029 | 0 | 0 | 1 | 1 | I am configuring access control for a web application based on the Pyramid framework. I am setting up permissions for my view callables using the @view_config decorator. I have two permissions, namely 'read' and 'write'. Now, I want certain views to require both permissions. I was unable to figure out how to do this wi... |
Python grabbing pages source with PHP in it | 15,057,740 | 0 | 0 | 128 | 0 | python,python-3.3 | PHP scripts are run server-side and produce a HTML document (among other things). You will never see the PHP source of a HTML document when requesting a website, hence there is no way for Python to grab it either. This isn't even Python-related. | 0 | 0 | 1 | 0 | 2013-02-24T22:52:00.000 | 2 | 0 | false | 15,057,651 | 0 | 0 | 1 | 1 | I know how to grab a sources HTML but not PHP is it possible with the built in functions? |
how to do with a request which needs to take a long time to run? | 15,059,615 | 0 | 1 | 73 | 0 | python,django | One way to do it is to create a row in a persistent database (or a redis key/value pair) for the task which says if it is running or finished. Have the code set the value to be running when the task starts and done when the task completes. Then have an AJAX call do a GET lookup on a URL that sends the status for the ta... | 0 | 0 | 0 | 0 | 2013-02-25T03:16:00.000 | 2 | 0 | false | 15,059,534 | 0 | 0 | 1 | 1 | I'm using Django to develop a classifier service, and user can build a model using api like http://localhost/api/buildmodel, however, because building a model takes a long time, maybe 2 hours, and I'm using web page to show the result of building a model. How to design my Django program to return immediately and do som... |
python webkit webview: Why does the history have dates that equal 0.0, and what needs to be fixed? | 16,125,745 | 0 | 2 | 192 | 0 | python,webkit,history,gtk3 | The history recording is supposed to be automatic. In this case, there is either no history command, or the appropriate command has not been initialized. You have to set a command to start the clock at a certain point, or else the time will always be 0 from the clock's point of view. I don't know the actual command, bu... | 0 | 0 | 0 | 0 | 2013-02-26T05:30:00.000 | 1 | 0 | false | 15,082,031 | 0 | 0 | 1 | 1 | I'm using GTK3 with python.
While accessing the backforward list the get_last_visited_time returns 0.0
The get_last_visited_time is being called in the notify status signal callback on load_status = FINISHED.
All the other values like uri, and title are the correct values. |
Google App Engine development server random (?) slowdowns | 15,098,634 | 2 | 2 | 237 | 1 | python,google-app-engine | Don't worry about it. It (IIRC) keeps the whole DB (datastore) in memory using a "emulation" of the real thing. There are lots of other issues that you won't see when deployed.
I'd suggest that your hard drive is spinning down and the delay you see is it taking a few seconds to wake back up.
If this becomes a problem... | 0 | 1 | 0 | 0 | 2013-02-26T19:54:00.000 | 2 | 0.197375 | false | 15,098,051 | 0 | 0 | 1 | 2 | I'm doing a small web application which might need to eventually scale somewhat, and am curious about Google App Engine. However, I am experiencing a problem with the development server (dev_appserver.py):
At seemingly random, requests will take 20-30 seconds to complete, even if there is no hard computation or data u... |
Google App Engine development server random (?) slowdowns | 15,106,246 | 0 | 2 | 237 | 1 | python,google-app-engine | Does this happen in all web browsers? I had issues like this when viewing a local app engine dev site in several browsers at the same time for cross-browser testing. IE would then struggle, with requests taking about as long as you describe.
If this is the issue, I found the problems didn't occur with IETester.
Sorry i... | 0 | 1 | 0 | 0 | 2013-02-26T19:54:00.000 | 2 | 0 | false | 15,098,051 | 0 | 0 | 1 | 2 | I'm doing a small web application which might need to eventually scale somewhat, and am curious about Google App Engine. However, I am experiencing a problem with the development server (dev_appserver.py):
At seemingly random, requests will take 20-30 seconds to complete, even if there is no hard computation or data u... |
Is it possible to reload (Windows) environment variables? | 15,099,480 | 3 | 0 | 7,103 | 0 | python,windows,environment-variables | If you set an environment variable in the registry (or via the System Properties > Advanced > Environment Variables UI), it will be global and persistent for every process launched from the top level context created after the variable was set. Shells and contexts initialized before your change will not pick up those c... | 0 | 1 | 0 | 0 | 2013-02-26T21:11:00.000 | 1 | 1.2 | true | 15,099,344 | 0 | 0 | 1 | 1 | Exactly what it says. I can set per-user environment variables, either from Windows > type "Path", or using RegEdit, or even from a Python script.
But if I run an application (e.g. from Launchy, or launch it from Chrome), it won't pick up the new variables. I've got to start a new cmd or Windows Explorer (I think) to g... |
How to setup a web app which can handle local data without uploading the data? Use python | 15,101,984 | 0 | 0 | 218 | 0 | javascript,python,google-chrome,web-applications,tsv | The whole point of a web application is that the GUI is written in HTML, CSS, and JavaScript, not Python. However, it talks to a web service, which can be written in Python.
For a well-written desktop app, the transition should be pretty easy. If you've already got a clean separation between the GUI part and the engine... | 0 | 0 | 1 | 0 | 2013-02-26T23:55:00.000 | 3 | 1.2 | true | 15,101,770 | 0 | 0 | 1 | 3 | I have a small python program to help my colleagues to analyse some tsv data. The data is not big, usually below 20MB. I developed the GUI with PyQT. I want to change this desktop program to a web app so my colleagues don't have to upgrade the program every time I change it or fix a bug. They can just go to a website a... |
How to setup a web app which can handle local data without uploading the data? Use python | 15,101,809 | 1 | 0 | 218 | 0 | javascript,python,google-chrome,web-applications,tsv | No, you cannot run Python code in a web browser.[1] You'd have to port the core of your application to JavaScript to do it all locally.
Just do the upload. 20MB isn't all that much data, and if it's stored on the server then they can all look at each others' results, too.
[1] There are some tools that try to transpi... | 0 | 0 | 1 | 0 | 2013-02-26T23:55:00.000 | 3 | 0.066568 | false | 15,101,770 | 0 | 0 | 1 | 3 | I have a small python program to help my colleagues to analyse some tsv data. The data is not big, usually below 20MB. I developed the GUI with PyQT. I want to change this desktop program to a web app so my colleagues don't have to upgrade the program every time I change it or fix a bug. They can just go to a website a... |
How to setup a web app which can handle local data without uploading the data? Use python | 32,979,390 | 0 | 0 | 218 | 0 | javascript,python,google-chrome,web-applications,tsv | If I get your point correctly, you want
Web connection, so your python program updated on server, client get it before using it.
Data store on local to avoid upload big file.
You can write a python program to check a server location to get your latest program if needed. You need a url / server file for program versio... | 0 | 0 | 1 | 0 | 2013-02-26T23:55:00.000 | 3 | 0 | false | 15,101,770 | 0 | 0 | 1 | 3 | I have a small python program to help my colleagues to analyse some tsv data. The data is not big, usually below 20MB. I developed the GUI with PyQT. I want to change this desktop program to a web app so my colleagues don't have to upgrade the program every time I change it or fix a bug. They can just go to a website a... |
Django 1.5 : Python 2.7 or Python 3 | 15,109,041 | 5 | 1 | 292 | 0 | django,python-2.7,python-3.x | The release notes state clearly that Python 3 support in 1.5 is experimental. And yes, third-party apps will be a problem. | 0 | 0 | 0 | 0 | 2013-02-27T09:47:00.000 | 3 | 0.321513 | false | 15,108,880 | 1 | 0 | 1 | 3 | Django just release their 1.5 version.
It now supports Python 3, my question is quite simple indeed: With this 1.5 Version, should I still use Python 2.7 or Python 3 ? I assume that with Python 3 there will be some issues with 3rd parties app no ?
In your case, what would you do ? |
Django 1.5 : Python 2.7 or Python 3 | 15,109,485 | 0 | 1 | 292 | 0 | django,python-2.7,python-3.x | I would still use python 2.7 because many apps and libraries are not ready for python 3.x
PIL is not working correctly with python 3 | 0 | 0 | 0 | 0 | 2013-02-27T09:47:00.000 | 3 | 0 | false | 15,108,880 | 1 | 0 | 1 | 3 | Django just release their 1.5 version.
It now supports Python 3, my question is quite simple indeed: With this 1.5 Version, should I still use Python 2.7 or Python 3 ? I assume that with Python 3 there will be some issues with 3rd parties app no ?
In your case, what would you do ? |
Django 1.5 : Python 2.7 or Python 3 | 15,109,147 | 0 | 1 | 292 | 0 | django,python-2.7,python-3.x | If I was starting a new development which I didn't expect to go live until well after version 1.6 is released (when Python 3 support is supposed to be production ready, and hopefully the 3rd party apps have caught up) , then yes, I would go with Python 3. It is significantly cleaner than Python 2.7.
But if you want you... | 0 | 0 | 0 | 0 | 2013-02-27T09:47:00.000 | 3 | 0 | false | 15,108,880 | 1 | 0 | 1 | 3 | Django just release their 1.5 version.
It now supports Python 3, my question is quite simple indeed: With this 1.5 Version, should I still use Python 2.7 or Python 3 ? I assume that with Python 3 there will be some issues with 3rd parties app no ?
In your case, what would you do ? |
Remove memcached completely from django | 21,271,795 | 0 | 0 | 440 | 0 | python,django,caching,memcached | This isn't anything to do with memcache; it sounds like the old compiled python scripts are still being used. Theoretically, restarting apache should do it. If not, deleting all the .pyc files (compiled python files; not .py, which are your source code) and restarting your server should force it to regenerate the .pyc ... | 0 | 0 | 0 | 0 | 2013-02-27T16:28:00.000 | 1 | 0 | false | 15,117,182 | 0 | 0 | 1 | 1 | Please tell some way to completely remove memcached from Django server. Using apache with mod WSGI and have already deleted all caches lines from settings.py but even that file is being cached.
Even removing settings.py doesn't stop site from working. This is ridiculous. There is no .pyc being formed which I could dele... |
Differentiate celery, kombu, PyAMQP and RabbitMQ/ironMQ | 15,131,010 | 2 | 9 | 7,047 | 0 | python,heroku,rabbitmq,celery,kombu | "One of the biggest differences between IronMQ and RabbitMQ/AMQP is that IronMQ is hosted and managed, so you don't have to host the server yourself and worry about uptime."
Currently there are at least two hosted managed RabbitMQ-as-a-service options: Bigwig and CloudAMQP. Celery should work well with both. | 0 | 1 | 0 | 0 | 2013-02-27T20:16:00.000 | 2 | 0.197375 | false | 15,121,519 | 0 | 0 | 1 | 1 | I want to upload images to S3 server, but before uploading I want to generate thumbnails of 3 different sizes, and I want it to be done out of request/response cycle hence I am using celery. I have read the docs, here is what I have understood. Please correct me if I am wrong.
Celery helps you manage your task queues ... |
Python: how to garbage collect strings | 15,156,807 | 2 | 2 | 1,633 | 0 | python,string,garbage-collection | You say:
I saw that every new string (with sys.getrefcount) have, at least, 2 references
But did you carefully read the description of getrefcount() ? :
sys.getrefcount()
object) Return the reference count of the object. The count returned
is generally one higher than you might expect, because it includes the
(... | 0 | 0 | 0 | 0 | 2013-03-01T11:08:00.000 | 2 | 0.197375 | false | 15,156,264 | 0 | 0 | 1 | 1 | I'm having a problem in a large-runtime script. This script is a multithreaded environment, to perform crawling tasks.
In large executions, script's memory consumption become huge, and after profiling memory with guppy hpy, I saw that most of the problem is coming by strings.
I'm not storing so many strings: just get c... |
Is slicing and dicing of distributed counter data in cassandra using pycassa possible? | 15,175,729 | 0 | 0 | 148 | 0 | python,cassandra,pycassa | I'm working with a system that has both the features you are asking for. We are using HBase (not Cassandra) and we write the URL + date in the key for every counter.
Then you can easily get the two reports you are looking for.
To get all page views for one URL, scan for keys beginning with and then add the counter val... | 0 | 0 | 0 | 0 | 2013-03-01T11:44:00.000 | 1 | 0 | false | 15,156,945 | 0 | 0 | 1 | 1 | I read and googled a lot but could not find a way to slice n dice a counter data based on a condition. Is there a way in Cassandra to do this? If yes, pl ease help me with it.
For example:
If I am using a counter to store the total page views, is there any way I can get the count of page views of a particular page url ... |
Django: Automatically executing statements in `manage.py shell` | 15,164,238 | -1 | 2 | 158 | 0 | python,django,shell | I ended up monkeypatching IPython.frontend.terminal.embed.InteractiveShellEmbed.__call__ to add the definitions I wanted. (I know many people are opposed to monkeypatching but I find it to be a good solution in this case.) | 0 | 1 | 0 | 0 | 2013-03-01T15:19:00.000 | 2 | 1.2 | true | 15,161,051 | 0 | 0 | 1 | 1 | Every time I start a shell using python manage.py shell, I want a few lines to be executed automatically. (In my case it would be a few import lines in the style of import django, my_app.)
How do I do this? |
Turning off model validation on Django dev-server | 15,172,677 | 1 | 1 | 827 | 0 | python,django,django-dev-server | This is not possible without modifying the source code of Django (which is not recommended). The only validation Django does on start-up is to check if the syntax of your model code is okay or not. It should not take more than 2-3 seconds. So, there are few other initialization are being done during startup which are a... | 0 | 0 | 0 | 0 | 2013-03-02T02:28:00.000 | 1 | 1.2 | true | 15,170,013 | 0 | 0 | 1 | 1 | Stage of models validation is most longest in Django dev-server startup. And in my case it mostly waste of time, since my models сhanging infrequently.
Is there way to turn off this? |
Heroku Python App - CSS Not Loading On IPhone Only | 15,181,474 | 0 | 0 | 381 | 0 | python,css,heroku,responsive-design,flask | Bug found. It was a very, very obscure rendering issue with the text-indent css attribute that only seemed to affect the iPhone 5.
Additionally, if you ever need to debug Google Chrome for iPhone, clearing the cache won't do anything if you don't delete the app from the multitasking menu too (the bar that comes up whe... | 0 | 0 | 0 | 0 | 2013-03-02T09:21:00.000 | 1 | 0 | false | 15,172,826 | 0 | 0 | 1 | 1 | First question posted to Stack Overflow but have spent many hours reading answers here :).
I'm creating a Heroku Python app and am using responsive design media queries in my css. I deploy my app to Heroku and visit myherokuapp.herokuapp.com. Website looks fine on laptop browser...responsive design elements working as... |
How do I inform a user if an event has been created by the admin in Django? | 15,181,386 | 0 | 0 | 542 | 0 | python,django | So, I can really only give you some general direction, as I don't know the particulars, but basically you could do something like this:
First, I would add an override to the save_model() method of your admin class. This is where you can check to see if your object has a primary key yet. If not, you can set a flag to cr... | 0 | 0 | 0 | 0 | 2013-03-02T16:55:00.000 | 2 | 0 | false | 15,177,002 | 0 | 0 | 1 | 1 | We're currently developing a system for a certain organization. One of the requirement is to inform users whenever the admin creates an event. All the site users should be notified not through e-mail but something similar to Facebook notification. How do I implement such feature in Django without using Django-notificat... |
Django Tastypie - serving emoji that are stored in db | 15,184,591 | 0 | 0 | 579 | 0 | python,django,emoji,tastypie | What if you save the JSON dump to a text file and open it with a UTF8 text editor? Will the emoji re-appear?
I suspect that, when displaying the JSON in the browser, the browser falls back to Latin-1 encoding, thus ending up with question marks. There might be a setting in your browser to set the encoding.
Check the "C... | 0 | 0 | 0 | 0 | 2013-03-02T19:35:00.000 | 2 | 0 | false | 15,178,533 | 0 | 0 | 1 | 1 | I'm using django and tastypie for my api. the db is MySQL.
After a few days of fiddling around i managed to store emoji icons in the db using utf8mb4 character set.
When querying the db directly from the console (on a mac), i see the emoji fine, but when pulling them from the api (for example using the browser),... |
How to resolve two slightly different names of same product (mobile phone) in program? | 15,189,643 | 3 | 2 | 555 | 0 | python,nlp,string-comparison,string-matching,string-parsing | You could use different approaches for this (and for most efficiency mix them):
You could ignore everythin that is in parenthesis.
Define words you automatically drop like "black", "blue" or "white".
Compare the names via their Levenshtein distance and use this distance for clustering.
Surface similarity (thanks to mb... | 0 | 0 | 0 | 0 | 2013-03-03T18:20:00.000 | 2 | 0.291313 | false | 15,189,056 | 1 | 0 | 1 | 1 | I am working on a web app where I collect data about mobile phones from several websites. The problem is that websites use slightly different naming of mobile phones. For eg the websites use the following variation in names for these two mobiles:
HTC One X+ (Black); HTC One X+ Black; HTC One X Plus; HTC One X Plus, bl... |
Does initialize in tornado.web.RequestHandler get called every time for a request/ | 15,202,174 | 8 | 3 | 1,206 | 0 | python,tornado | Yes, tornado calls initialize for each request.
If you want to share state between requests(like db connection) - store it in self.application. | 0 | 1 | 0 | 0 | 2013-03-04T10:09:00.000 | 1 | 1.2 | true | 15,199,028 | 0 | 0 | 1 | 1 | There'a an initialize method in tornado.web.RequestHandler class, is it called every time there's a request? |
AppEngine NDB property validations | 15,202,052 | 0 | 0 | 744 | 0 | python,google-app-engine,app-engine-ndb,wtforms,google-cloud-endpoints | Not this is is always the best solution, but you could roll your own. Just pre-define a bunch of properties with reg-exs/mins and maxs etc. It seems like your properties are straight forward enough that it wouldn't be too difficult. | 0 | 1 | 0 | 0 | 2013-03-04T11:53:00.000 | 1 | 0 | false | 15,200,952 | 0 | 0 | 1 | 1 | I wonder what the best approach is for validating NDB entity properties likes:
a date must be in the future
a grade (integer property) must be between 1 and 10
a reference to another entity must have certain property values (e.g. book.category.active must be True)
I'm also using WTForms to validate submitted requests... |
How can I use MySQL with Python 3.3 and Django 1.5? | 15,203,056 | 0 | 1 | 713 | 1 | python,mysql,django | As others have noted, Python 3 support in Django 1.5 is "experimental" and, as such, not everything should be expected to work.
That being said, if you absolutely need to get this working, you may be able to run the 2to3 tool on a source version of MySQL-python to translate it to Python 3 (and build against Python 3 h... | 0 | 0 | 0 | 0 | 2013-03-04T13:18:00.000 | 3 | 0 | false | 15,202,503 | 0 | 0 | 1 | 1 | Django needs MySQL-python package to manipulate MySQL, but MySQL-python doesn't support Python 3.3. I have tried MySQL-for-Python-3, but it doesn't work.
Please help! Thanks a lot! |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.