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 user should own my Python scripts and application directories? | 13,730,842 | 1 | 1 | 112 | 0 | python,linux,web-applications,chown | The proper way is to compile to bytecode on install so that .pyc files never need to be created on the fly. The rest is basic stuff, like "never use 0777/0666". | 0 | 0 | 0 | 0 | 2012-12-05T19:18:00.000 | 1 | 1.2 | true | 13,730,790 | 0 | 0 | 1 | 1 | I've been using chown www-data:www-data -R /path/to/my/django-app/ and simply letting my virtualenv's dirs / files be owned by root (since sudo pip install foo implies that by default). This just doesn't feel right though. Is this pretty typical, or, should www-data only own directories that it can upload files to? If ... |
Invalidate an old session in Flask | 21,083,908 | 12 | 27 | 25,119 | 0 | python,flask | If you have security concerns (and everyone should have) There is the answer:
This is not REALLY possible
Flask uses cookie-based sessions. When you edit or delete session, you send a REQUEST to CLIENT to remove the cookie, normal clients (browsers) will do. But if session hijacked by an attacker, the attacker's sessio... | 0 | 0 | 0 | 0 | 2012-12-06T00:30:00.000 | 4 | 1 | false | 13,735,024 | 0 | 0 | 1 | 1 | How do I create a new clean session and invalidate the current one in Flask?
Do I use make_null_session() or open_session()? |
How do you specify the html5 doctype with Python Chameleon? | 15,097,605 | 2 | 3 | 367 | 0 | python,chameleon,template-metal | Figured it out. You need to wrap the entire master template in a metal tag like so: <metal:macro metal:define-macro="layout"> <!DOCTYPE html> ... </html></metal:macro> | 0 | 0 | 0 | 0 | 2012-12-06T15:25:00.000 | 1 | 1.2 | true | 13,746,872 | 0 | 0 | 1 | 1 | I've thoroughly RTFMed and Googled for this, and I can't seem to find the answer. I am new to Chameleon, so maybe it's just so obvious that it's no where to be found, but when I put
<!DOCTYPE html>
in my master template, the rendered page has it stripped out resulting in the dreaded quirksmode.
Is there a trick that I'... |
Django session race condition? | 13,924,932 | 7 | 8 | 1,895 | 0 | python,django,multithreading,session,race-condition | Yes, it is possible for a request to start before another has finished. You can check this by printing something at the start and end of a view and launch a bunch of request at the same time.
Indeed the session is loaded before the view and saved after the view. You can reload the session using request.session = engine... | 0 | 0 | 0 | 0 | 2012-12-06T16:33:00.000 | 3 | 1.2 | true | 13,748,166 | 0 | 0 | 1 | 1 | Summary: is there a race condition in Django sessions, and how do I prevent it?
I have an interesting problem with Django sessions which I think involves a race condition due to simultaneous requests by the same user.
It has occured in a script for uploading several files at the same time, being tested on localhost. I ... |
Continuous integration with python 2.7 / flask / mongoDB / git | 13,767,025 | 1 | 4 | 1,085 | 0 | python,git,continuous-integration,flask,gunicorn | buildbot, jenkins/hudson but these give you continuous integration in the sense you can run a "make" equivalent with every code base change through a commit hook. You could also look at vagrant if there is something there for you for creating repeatable vm's wrt to config/setup. Could tie it with a commit hook. | 0 | 0 | 0 | 1 | 2012-12-06T18:48:00.000 | 1 | 0.197375 | false | 13,750,417 | 0 | 0 | 1 | 1 | How should I implement continuous integration on my new application? Currently, this is how we're pushing to production - please bear with me, I know this is far from sane:
From local, git push origin production (the production codebase is kept on the production branch, modifications are either written directly there ... |
Can I install Selenium2Library for RobotFramework without installing Python? | 13,769,988 | 2 | 0 | 1,914 | 0 | python,jython,robotframework | So after some reading and trial and error, it IS possible to use Selenium2Library with only Jython AS LONG AS you use jython 2.7+ ... jython 2.5.x is NOT compatible with Selenium2Library.
So you can get away with not using Python at all:
Install jython 2.7+
Install ez_setup.py
Install robot framework
Install Selenium... | 0 | 0 | 0 | 0 | 2012-12-06T23:48:00.000 | 1 | 0.379949 | false | 13,754,725 | 1 | 0 | 1 | 1 | Can I use Selenium2Library if I only have Jython? That is, I haven't installed Python, and was hoping to get away with not needing it. I've read conflicting information however that jybot CANNOT use selenium2library, and I'll need pybot to use it.
If jybot can't use selenium2Library, is there a way to have jybot call p... |
How to make almost static site in Pyramid? | 14,030,455 | 0 | 3 | 720 | 0 | python,pyramid | This is somewhat a different answer than ohters but here is a completely different flow.
Write all your pages in html. Everything!!! and then use something like angularjs or knockoutjs to add dynamic content. Pyramid will serve dynamic content requested using ajax.
You can then map everything to you html templates...... | 0 | 0 | 0 | 1 | 2012-12-07T02:32:00.000 | 3 | 0 | false | 13,756,090 | 0 | 0 | 1 | 1 | I'm switching to Pyramid from Apache/PHP/Smarty/Dreamweaver scheme.
I mean the situation of having static site in Apache with menu realized via Dreamweaver template or other static tools. And then if I wanted to put some dynamic content in html I could make the following:
Put smarty templates in html.
Create php beh... |
Does a smaller application footprint mean cheaper PaaS costs? which language? | 13,756,326 | 0 | 4 | 216 | 0 | python,ruby,node.js,grails,cloud | Memory footprint will certainly reflect on your PaaS expenses.
But to tell you what to use is hard without knowing more about the project.
Node.js per se is great, but it's not perfect for every case.
Python is very friendly for development, and has ok memory usage, but again - it all depends on what you're doing. | 0 | 0 | 0 | 0 | 2012-12-07T02:57:00.000 | 2 | 0 | false | 13,756,269 | 0 | 0 | 1 | 1 | So, I have built and deployed a Grails app onto cloudfoundry.
And as I play around with examining instances & memory I start to wonder;
If my app's footprint is larger because of the technology I chose to develop it in, will it start costing me money sooner rather than later? Surely it must?
If that is the case, am I b... |
Session managment, SSL, WSGI and Cookies | 13,762,690 | 3 | 1 | 690 | 0 | python,session,cookies,ssl,wsgi | What's wrong with your protocol
You might want to consider the following:
Alice contacts your server and obtains an SSL session ID S. A cookie containing H(S) is sent to Alice.
Bob is listening in on the exchange. The SSL session ID is not encrypted, so he can read S.
Bob contacts your server with the session cookie s... | 0 | 0 | 0 | 0 | 2012-12-07T11:18:00.000 | 1 | 0.53705 | false | 13,762,051 | 0 | 0 | 1 | 1 | I'm reviewing the possibility and advisability of implementing wsgi-app to browser session management, without using any off the shelf middleware.
The general approach under consideration is to;
Use SSL between the browser and the server.
Expose the SSL session ID to the WSGI or OS.environment, to be used as a session ... |
How override default admin static files? | 13,770,047 | 0 | 0 | 118 | 0 | python,django,django-admin | The django package is hosted on your server. Have you considered changing the images for icon_error.png and icon_success.png, then resaving them with the same name on your filesystem?
The location where you can find the static image files within the django package is:
/ django / django / contrib / admin / static / adm... | 0 | 0 | 0 | 0 | 2012-12-07T19:01:00.000 | 2 | 0 | false | 13,769,381 | 1 | 0 | 1 | 1 | How can I override default admin static files - for example icon_error.png, icon_success.png ? |
How can I have django-taggit tags deleted when there are no more objects attached to them? | 13,772,887 | 3 | 2 | 728 | 0 | python,django,django-taggit | The only technique I can think of would be to attach a custom pre_delete signal handler to every taggable model that checks if it was the last model with any particular tag. In the event that it is, delete that tag. | 0 | 0 | 0 | 0 | 2012-12-07T23:39:00.000 | 2 | 1.2 | true | 13,772,750 | 0 | 0 | 1 | 1 | I think the title says it. Many tags are created and deleted but they still exist even when no more objects are using them.
Is there a way to make it check upon save and delete unused tags? |
local GAE datastore does not keep data after computer shuts down | 13,779,121 | 1 | 4 | 2,643 | 0 | google-app-engine,python-2.7,google-cloud-datastore | The datastore typically saves to disk when you shut down. If you turned off your computer without shutting down the server, I could see this happening. | 0 | 1 | 0 | 0 | 2012-12-08T10:27:00.000 | 3 | 0.066568 | false | 13,776,610 | 0 | 0 | 1 | 1 | On my local machine (i.e. http://localhost:8080/), I have entered data into my GAE datastore for some entity called Article. After turning off my computer and then restarting next day, I find the datastore empty: no entity. Is there a way to prevent this in the future?
How do I make a copy of the data in my local datas... |
Django - how to set up asynchronous longtime background data processing task? | 13,783,426 | 0 | 4 | 2,371 | 0 | python,django,background-process,backend | Why don't you have a url or python script that triggers whatever sort of calculation you need to have done everytime it's run and then fetch that url or run that script via a cronjob on the server? From what your question was it doesn't seem like you need a whole lot more than that. | 0 | 0 | 0 | 0 | 2012-12-08T18:52:00.000 | 3 | 0 | false | 13,780,732 | 0 | 0 | 1 | 1 | Newb quesion about Django app design:
Im building reporting engine for my web-site. And I have a big (and getting bigger with time) amounts of data, and some algorithm which must be applied to it. Calculations promise to be heavy on resources, and it would be stupid if they are performed by requests of users. So, I thi... |
How To See A Database On Heroku | 13,782,284 | 0 | 0 | 61 | 0 | python,database,heroku | You can connect directly to it using something like PGAdmin, look at the output of heroku config for your application to get your database URL which you can breakup to use in GUI tools. | 0 | 0 | 0 | 0 | 2012-12-08T19:54:00.000 | 1 | 0 | false | 13,781,287 | 0 | 0 | 1 | 1 | How do I see the database for my heroku web app?
I just want to verify if users are being registered, properly, etc.
I am using Flask-SQLAlchemy Python, if that makes a difference. |
Capture Visible Webpage Content (or text) as if Copying from Browser | 13,787,570 | 2 | 0 | 781 | 0 | python,selenium,screen-scraping,web-scraping,screenshot | Sure. Use Selenium and just loop through all visible, displayable elements. | 0 | 0 | 1 | 0 | 2012-12-09T07:48:00.000 | 1 | 0.379949 | false | 13,785,630 | 0 | 0 | 1 | 1 | Is there a way to capture visible webpage content or text as if copying from a browser display to parse later (maybe using regular expression etc)? I don't mean to clean the html tags, javascript, etc and only show leftover text. I would like to copy all visible text, since some style elements may hide some of the htm... |
XMPP-- openfire,PHP and python web service | 13,797,108 | 0 | 0 | 1,049 | 0 | python,web-services,xmpp,openfire,strophe | It seems to me like XMPP is a bit of a heavy-weight solution for what you're doing, given that communication is just one-way and you're just sending notifications (no real-time multi-user chat etc.).
I would consider using something like Socket.io (http://socket.io) for the server<=>client channel along with Redis (htt... | 0 | 0 | 0 | 1 | 2012-12-09T12:07:00.000 | 1 | 0 | false | 13,787,244 | 0 | 0 | 1 | 1 | I am planning to integrate real time notifications into a web application that I am currently working on. I have decided to go with XMPP for this and selected openfire server which i thought to be suitable for my needs.
The front end uses strophe library to fetch the notifications using BOSH from my openfire server. Ho... |
Secure localhost JavaScript ajax requests | 13,788,959 | 1 | 2 | 320 | 0 | javascript,python,ajax,localhost | The most direct way to protect against this attack is to just have a long complex secret key being required for every request. Just make your local code authenticate itself before processing the request. This is essentially how web services on the Internet are protected.
You might also want to consider having inter pro... | 0 | 0 | 1 | 0 | 2012-12-09T14:14:00.000 | 1 | 1.2 | true | 13,788,172 | 0 | 0 | 1 | 1 | I have a written an app, with python acting as a simple web server (I am using bottle framework for this) and an HTML + JS client. The whole thing runs locally. The web page acts as GUI in this case.
In my code I have implemented a file browser interface so I can access local file structure from JavaScript.
The server ... |
Django MPTT ordering | 14,391,692 | 0 | 2 | 629 | 0 | python,django,recursion,tree,mptt | I have been sitting here for five minutes and I can't think of a way to do this in SQL given the data structure you are describing. To begin with, I would suggest that you separate your data into Posts and Comments, rather than just having one sort of data object. Then you can do a join to gather the comments togethe... | 0 | 0 | 0 | 0 | 2012-12-10T02:58:00.000 | 2 | 0 | false | 13,794,399 | 0 | 0 | 1 | 2 | I'm using MPTT tree structure in my Django project to organise comments. I have only 2 level : comment and comment of comment
Everything works perfectly except the ordering.
I would like to sort all Comment that don't have parents by creation date ascendent ("-creation_date") and all comment that has a parent by creati... |
Django MPTT ordering | 14,846,769 | -1 | 2 | 629 | 0 | python,django,recursion,tree,mptt | I found a solution so I forgot to check back.
I played around with the mptt structure and django functions ...
Thanks | 0 | 0 | 0 | 0 | 2012-12-10T02:58:00.000 | 2 | -0.099668 | false | 13,794,399 | 0 | 0 | 1 | 2 | I'm using MPTT tree structure in my Django project to organise comments. I have only 2 level : comment and comment of comment
Everything works perfectly except the ordering.
I would like to sort all Comment that don't have parents by creation date ascendent ("-creation_date") and all comment that has a parent by creati... |
Saving the stack? | 13,810,563 | 1 | 6 | 156 | 0 | python,ruby,jvm,stack | Good question.
In Smalltalk, yes.
Actually, in Smalltalk, dumping the whole program and restarting is the only way to store and share programs. There are no source files and there is no way of starting a program from square zero. So in Smalltalk you would get your feature for free.
The Smalltalk VM offers a hook where ... | 0 | 0 | 0 | 1 | 2012-12-10T20:51:00.000 | 3 | 0.066568 | false | 13,809,013 | 1 | 0 | 1 | 1 | I'm just curious, is it possible to dump all the variables and current state of the program to a file, and then restore it on a different computer?!
Let's say that I have a little program in Python or Ruby, given a certain condition, it would dump all the current variables, and current state to a file.
Later, I could l... |
GAE development server keep full text search indexes after restart? | 20,389,173 | -2 | 8 | 1,909 | 0 | python,google-app-engine,google-cloud-datastore,google-search | Look like this is not an issue anymore. according to documentation (and my tests):
"The development web server simulates the App Engine datastore using a
file on your computer. This file persists between invocations of the
web server, so data you store will still be available the next time
you run the web server... | 0 | 1 | 0 | 0 | 2012-12-12T16:12:00.000 | 3 | -0.132549 | false | 13,843,907 | 0 | 0 | 1 | 2 | Is there anyway of forcing the GAE dev server to keep full text search indexes after restart? I am finding that the index is lost whenever the dev server is restarted.
I am already using a static datastore path when I launch the dev server (the --datastore_path option). |
GAE development server keep full text search indexes after restart? | 13,849,805 | 2 | 8 | 1,909 | 0 | python,google-app-engine,google-cloud-datastore,google-search | This functionality was added a few releases ago (in either 1.7.1 or 1.7.2, I think). If you're using an SDK from the last few months it should be working. You can try explicitly setting the --search_indexes_path flag on dev_appserver.py; it's possible that the default location (/tmp/) isn't writable. Could you post the... | 0 | 1 | 0 | 0 | 2012-12-12T16:12:00.000 | 3 | 0.132549 | false | 13,843,907 | 0 | 0 | 1 | 2 | Is there anyway of forcing the GAE dev server to keep full text search indexes after restart? I am finding that the index is lost whenever the dev server is restarted.
I am already using a static datastore path when I launch the dev server (the --datastore_path option). |
python html parser which doesn't modify actual markup? | 18,350,504 | 0 | 1 | 273 | 0 | python,html,parsing | No, to this moment there is no such HTML parser and every parser has it's own limitations. | 0 | 0 | 1 | 0 | 2012-12-13T11:44:00.000 | 3 | 1.2 | true | 13,859,124 | 0 | 0 | 1 | 1 | I want to parse html code in python and tried beautiful soup and pyquery already. The problem is that those parsers modify original code e.g insert some tag or etc. Is there any parser out there that do not change the code?
I tried HTMLParser but no success! :(
It doesn't modify the code and just tells me where tags a... |
Django Signal vs Python Threading | 13,892,073 | 1 | 2 | 769 | 0 | python,django,django-signals | I would suggest you to use django-celery with RabbitMQ. You can add the notifications thing in the tasks of celery and have your view start the task queque. Have a look....I hope it will be helpful to you. | 0 | 0 | 0 | 0 | 2012-12-14T00:25:00.000 | 1 | 1.2 | true | 13,870,894 | 0 | 0 | 1 | 1 | Its hard to explain what I am trying to achieve. Please have the patience to go through this. And let me know if you have any questions.
Say I have a Django project with two applications which I would like to have them coupled loosely. One of the application is 'Jobs' and other is 'Notifications'.
Now I want to create... |
How can I track s3 bucket folder usage with python? | 13,892,252 | 0 | 0 | 818 | 1 | python,django,amazon-s3 | No its not possible to create a bucket for each user as Amazon allows only 100 buckets per account. So unless you are sure not to have more than 100 users, it will be a very bad idea.
The ideal solution will be to remember each user's storage in you Django app itself in database. I guess you would be using S3 boto libr... | 0 | 0 | 1 | 0 | 2012-12-14T05:20:00.000 | 2 | 0 | false | 13,873,119 | 0 | 0 | 1 | 1 | I'm building a file hosting app that will store all client files within a folder on an S3 bucket. I then want to track the amount of usage on S3 recursively per top folder to charge back the cost of storage and bandwidth to each corresponding client.
Front-end is django but the solution can be python for obvious reaso... |
Navigation utility without browser, light weight and fail-proof | 13,873,743 | 5 | 3 | 811 | 0 | python,selenium,scrapy,selenium-webdriver,phantomjs | Use Htmlunitdriver.For making it fail proof You would have to make some changes accordingly.But It will work without browser. | 0 | 0 | 1 | 0 | 2012-12-14T06:23:00.000 | 2 | 0.462117 | false | 13,873,719 | 0 | 0 | 1 | 1 | I have a use case where I need to fill the form in a website but don't have access to API. Currently we are using webdriver along with browser but it gets very heavy and not fool proof as the process is asynchronous. Is there any way I can do it without browser and also make the process synchronous by closely monitorin... |
Django absolute url works but relative url does not for static files | 13,873,805 | 1 | 1 | 1,375 | 0 | python,django,web,static | django requires STATIC_DIR to be absolute path.
set a variable like PROJECT_DIR to os.path.dirname(os.path.realpath(__file__)).
then set STATIC_DIR to os.path.join(PROJECT_DIR, 'static') | 0 | 0 | 0 | 0 | 2012-12-14T06:26:00.000 | 1 | 1.2 | true | 13,873,755 | 0 | 0 | 1 | 1 | I have searched around and apologize if this is a basic question. I am trying to get my django app to serve static files. If the STATIC_URL is set to the absolute path (ie http://localhost/static) then the files work however if STATIC_URL is relative like /static/ it doesn't pull in any static files.
I would like it ... |
Image upload and Manipulation in Django | 13,877,675 | 2 | 1 | 955 | 0 | python,django,amazon-web-services,amazon-s3,django-uploads | Uhm, you need to be more specific with your question, but we're doing the same thing and the workflow is as follows:
1) You get the file handle on file upload from request.FILES and store it somewhere on your local filesystem, so you don't work on stream -- which is what i would guess is causing your problems
2) You us... | 0 | 0 | 0 | 0 | 2012-12-14T10:58:00.000 | 3 | 0.132549 | false | 13,877,327 | 0 | 0 | 1 | 2 | I am trying upload images and than create an thumbnail of it and than store both in S3. After the file has been uploaded i am first uploading it to S3 and than trying to create thumbnail but it doesn't work as than PIL is not able to recognise the image. And secondly if I create the thumbnail first than while uploading... |
Image upload and Manipulation in Django | 13,889,477 | 0 | 1 | 955 | 0 | python,django,amazon-web-services,amazon-s3,django-uploads | I finally figured it out. The problem was that it was a stream that the uploaded file is stored into, so everytime i read the file it would reach the EOF.
The only and best way out is to seek(0) everytime we read the file.
This is also needed when playing with other files also in django. | 0 | 0 | 0 | 0 | 2012-12-14T10:58:00.000 | 3 | 0 | false | 13,877,327 | 0 | 0 | 1 | 2 | I am trying upload images and than create an thumbnail of it and than store both in S3. After the file has been uploaded i am first uploading it to S3 and than trying to create thumbnail but it doesn't work as than PIL is not able to recognise the image. And secondly if I create the thumbnail first than while uploading... |
Run multiple find and replaces in Python (on every file in the folder and sub-folder) | 13,885,541 | 0 | 1 | 139 | 0 | python | Use the glob module to get a list of *.html files. | 0 | 0 | 0 | 0 | 2012-12-14T20:05:00.000 | 2 | 0 | false | 13,885,520 | 0 | 0 | 1 | 1 | I have a folder (courses) with sub-folders and a random number of files. I want to run multiple search and replaces on those random files. Is it possible to do a wild card search for .html and have the replaces run on every html file ?
Search and replaces:
1) "</b>" to "</strong>"
2) "</a>" to "</h>"
3) "<p>" to "</p>... |
pip install web2py | 14,100,013 | 2 | 5 | 2,902 | 0 | python,pip,web2py | I think I can give my answer to my own question: we don't need to install web2py, just download it and python it. | 0 | 0 | 0 | 0 | 2012-12-16T08:46:00.000 | 2 | 1.2 | true | 13,899,823 | 0 | 0 | 1 | 1 | I tried to install Web2py with pip. The installation is completed successfully. But after that I don't know how to start the server. I know there are three apps which are 'w2p_clone', 'w2p_apps' and 'w2p_run'. I don't know how to use these three apps. And also I did not set up my virtual env for Web2py, however even I ... |
openerp reporting syntax | 13,906,107 | 2 | 2 | 1,361 | 0 | python,report,openerp,tryton | in the first table cell, this worked:
[[((case.excluded == False) or removeParentNode('blockTable')) and '']][[case.name]]
although i am still interested in knowing if there's a more logical way instead of destroying the entire created blocktable, especially since i'll be trying to figure out how not to leave an empty ... | 0 | 0 | 0 | 0 | 2012-12-16T22:09:00.000 | 4 | 1.2 | true | 13,905,975 | 0 | 0 | 1 | 2 | I've been struggling trying to mimic in openerp a report found in Tryton for the module Health GNU. In their report folder lies a report.odt file very similar to any sxw report found in openerp, with a few exceptions that is. For instance, instead of openERP's:
[[repeatIn(objects,'test')]]
we have an opening and clo... |
openerp reporting syntax | 13,925,567 | 2 | 2 | 1,361 | 0 | python,report,openerp,tryton | You can iterate on a list generated by a function defined on report's related .py file.
Just look for examples on the addons, there are plenty of them, like:
account/report/account_aged_partner_balance.rml:
[[ repeatIn(get_lines(data['form']), 'partner') ]] | 0 | 0 | 0 | 0 | 2012-12-16T22:09:00.000 | 4 | 0.099668 | false | 13,905,975 | 0 | 0 | 1 | 2 | I've been struggling trying to mimic in openerp a report found in Tryton for the module Health GNU. In their report folder lies a report.odt file very similar to any sxw report found in openerp, with a few exceptions that is. For instance, instead of openERP's:
[[repeatIn(objects,'test')]]
we have an opening and clo... |
Correct latin-1 encoded UTF-8 in Django-ORM | 14,781,925 | 1 | 2 | 937 | 0 | python,mysql,django,django-orm | I know that this might be OFF...
but maybe prevents some headache
before you make any "unicode" related change then please get to know what unicode means, and note that what you wrote "ö" == ö is only right when the unicode is encoded by the method UTF-8 | 0 | 0 | 0 | 0 | 2012-12-17T01:47:00.000 | 2 | 0.099668 | false | 13,907,359 | 0 | 0 | 1 | 1 | I'm setting up a django-admin on top of a legacy MySQL database.
The database declares that it is latin-1 encoded. Some of the entered data in the database is indeed in latin-1 but some is actually UTF-8. This shows up as corrupt characters like: é € ä ö
The legacy application does some black magic to hide these e... |
How to set Flask blueprints to allow anonymous access? | 13,908,497 | 6 | 1 | 344 | 0 | python,authentication,flask | Flask does not require any authentication by default. Usually you have to decorate your view functions if you want such behaviour. So your error is most likely within your web server configuration. | 0 | 0 | 0 | 0 | 2012-12-17T04:54:00.000 | 1 | 1 | false | 13,908,455 | 0 | 0 | 1 | 1 | I'm working on a Flask application and don't see in the documentation how to turn off the requirement for a user to be logged in. We need to do this for some REST services coinciding
(possibly) with some pages that do require logins.
What's the best way to do this? I've scoured the docs and snippets and don't see how t... |
User registration using django and backbone over a RESTful API | 13,910,427 | 1 | 1 | 455 | 0 | javascript,python,django,web-applications,backbone.js | You need a REST backend in your django application in order to communicate with backbone.
Django views are built to respond with html but they can also respond with json.
I wouldn't recommend trying to build your own json views though, but rather use something like django-tastypie | 0 | 0 | 0 | 0 | 2012-12-17T07:42:00.000 | 3 | 0.066568 | false | 13,910,113 | 0 | 0 | 1 | 1 | I'm building a simple application as part of my learning(to understand REST APIs) using django and backbone. I would like to create a user registration and pass these values to django backend using json. Can someone point me to some examples and source codes to construct good APIs using django and using them with backb... |
Best practice for making a django webapp restart itself | 13,922,532 | 0 | 1 | 403 | 0 | python,django,caching | If you are running it on apache with mod_wsgi, just update the timestamp of wsgi config file everytime you make change to a model. Apache automatically restarts the application if the wsgi file gets updated. | 0 | 0 | 0 | 0 | 2012-12-17T20:07:00.000 | 4 | 0 | false | 13,921,373 | 0 | 0 | 1 | 2 | We have certain sysadmin settings that we expose to superusers of our django webapp. Things like the domain name (uses contrib.sites) and single sign-on configuration. Some of these settings are cached by the system, sometimes because we want to avoid an extra DB hit in the middleware on every request if we can help it... |
Best practice for making a django webapp restart itself | 13,929,058 | 0 | 1 | 403 | 0 | python,django,caching | It depends on your setup:
If you are using wsgi on a single server you could touch the wsgi file to let apache restart every instance of the app
If you are using gunicorn you probably use supervisord to controll it. Then a supervisorctl restart APPNAME would be the solution
If you scale your app on multiple servers yo... | 0 | 0 | 0 | 0 | 2012-12-17T20:07:00.000 | 4 | 0 | false | 13,921,373 | 0 | 0 | 1 | 2 | We have certain sysadmin settings that we expose to superusers of our django webapp. Things like the domain name (uses contrib.sites) and single sign-on configuration. Some of these settings are cached by the system, sometimes because we want to avoid an extra DB hit in the middleware on every request if we can help it... |
Django: How can i get the sections of pdf file and jump to them? | 14,459,121 | 0 | 1 | 119 | 0 | javascript,jquery,python,html,django | I`m not sure, that I understand you correctly, but if you talk about Named Destinations in PDF file you should:
get Named Destinations of PDF file with pyPdf library with "getNamedDestinations" method
open PDF file with nameddest parameter like "http://example.org/doc.pdf#nameddest=something" | 0 | 0 | 0 | 0 | 2012-12-18T15:10:00.000 | 1 | 0 | false | 13,935,864 | 0 | 0 | 1 | 1 | I develop a simple site in django.
in this site the user has to upload a pdf file,
and then he can see it with tree of sections in the side.
The challenge is:
A. How can i read the file sections?
it could be in django, python, javascript or each another idea.
B. How can i jump to specific section when the user click on... |
Full text search in appengine, make some fields scores more important than others? | 13,942,535 | 2 | 0 | 152 | 0 | python,google-app-engine,full-text-search | Unfortunately yes; we don't yet have a way for you to weight different fields more or less than others. Sorry! | 0 | 1 | 0 | 0 | 2012-12-18T19:06:00.000 | 1 | 0.379949 | false | 13,939,773 | 0 | 0 | 1 | 1 | I have a python appengine app that uses full text search. The document model has something like
title: title
abstract: short abstract
full text: lots and lots of text
If someone searches for a string, I want it ordered such that score for matches in title >> abstract >> full text. There doesn't seem to be a way to do... |
Streaming audio in Python with TideSDK | 13,948,150 | 2 | 0 | 401 | 0 | python,html,tidesdk | The current version has very old webkit so because of that the HTML5 support is lacking. Audio and video tags are currently not supported in windows because underlying webkit implementation (wincairo) does not support it. Wa are working on the first part to use the latest webkit. once completed we are also planning to ... | 0 | 0 | 0 | 1 | 2012-12-18T19:52:00.000 | 1 | 0.379949 | false | 13,940,449 | 0 | 0 | 1 | 1 | Iam trying to stream audio in my TideSDK application, but it seems to be quite difficult. The HTML5 audio does not work for me, neither does video tags. The player simply keeps loading. I've tested and confirmed that my code worked in many other browsers.
My next attemp was VLC via Python bindings. But without any conf... |
How do I upload a file to a subfolder even if it doesn't exist | 13,944,967 | 0 | 2 | 206 | 0 | python,google-drive-api | The solution you have presented is the correct one. As you have realized, the Drive file system is not exactly like a hierarchical file system, so you will have to perform these checks.
One optimization you could perform is to try to find the grand-child folder (Sub2) first, so you will save a number of calls. | 0 | 0 | 0 | 0 | 2012-12-19T02:45:00.000 | 1 | 1.2 | true | 13,944,798 | 0 | 0 | 1 | 1 | I have a Django app that needs to create a file in google drive: in FolderB/Sub1/Sub2/file.pdf. I have the id for FolderB but I don't know if Sub1 or Sub2 even exist. If not it should be created and the file.pdf should be put in it.
I figure I can look at children at each level and create the folder at each level if it... |
sort_options only applied when query_string is not empty? | 13,954,922 | -2 | 8 | 103 | 1 | python,google-app-engine,gae-search | Could be a bug in the way you build your query, since it's not shown.
Could be that you don't have an index for the case that isn't working. | 0 | 0 | 0 | 0 | 2012-12-19T13:02:00.000 | 2 | -0.197375 | false | 13,953,039 | 0 | 0 | 1 | 1 | trying to figure out whether this is a bug or by design. when no query_string is specified for a query, the SearchResults object is NOT sorted by the requested column. for example, here is some logging to show the problem:
Results are returned unsorted on return index.search(query):
query_string = ''
sort_options strin... |
clicking the back button in django admin site | 13,956,144 | 1 | 1 | 518 | 0 | python,django-admin | What's happening
Chrome is not fetching the page again, just displaying what was there "before" and Chrome stored in its cache.
Chrome is not even asking your webserver about the page, and as far as your app knows, you never went back to that page.
Don't worry about it
However, if you:
Refresh the page
Try to POST som... | 0 | 0 | 0 | 0 | 2012-12-19T15:49:00.000 | 1 | 1.2 | true | 13,956,049 | 0 | 0 | 1 | 1 | I am new to Django . I am trying out the django admin/auth system. I logged into the admin site first and then I logged out . After logging out and clicking the back button on my browser(Chrome) I am still getting the old admin page . Should it not be redirected to login page instead? If so Is there some configuration ... |
Does a GAE app keep a log of the emails it sends? | 13,957,307 | 6 | 4 | 88 | 0 | python,google-app-engine | you can try one of the following way:
Log
write a log to datastore while each time you call sent_mail.
write log with logging module and check the log in dashboard.
mail
while send the email, add a debug email address in email's "bcc" field.
you can also check the "sent mail" in the email account used as sender. | 0 | 1 | 0 | 1 | 2012-12-19T16:27:00.000 | 1 | 1.2 | true | 13,956,774 | 0 | 0 | 1 | 1 | Wondering if it is possible to see a history of emails that a GAE app has sent? Need to look into the history for debugging purposes.
Note that logging when I send the email or bcc'ing a user are not options for this particular question as the period I'm curious about was in the past (since then we are bcc'ing). |
Selenium test suite only open browser once | 13,957,461 | 5 | 1 | 601 | 0 | python,selenium | You can use class or module level setup and teardown methods instead of test level setup and teardown. Be careful with this though, as if you don't reset your test environment explicitly in each test, you have to handle cleaning everything out (cookies, history, etc) manually, and recovering the browser if it has cras... | 0 | 0 | 1 | 1 | 2012-12-19T17:02:00.000 | 1 | 0.761594 | false | 13,957,413 | 0 | 0 | 1 | 1 | We have a suite of selenium tests that on setup and teardown open and close the browser to start a new test.
This approach takes a long time for tests to run as the opening and closing is slow. Is there any way to open the browser once in the constructor then reste on setup and cleanup on teardown, then on the deconstr... |
does GAE support django admin form | 13,958,619 | 2 | 2 | 67 | 0 | python,html,django,google-app-engine,datastore | If you're using CloudSQL, django models are supported, and you'll be fine.
If you're using the HRD, getting the admin pages to work would be more difficult.
django models are not supported. The app engine SDK comes with django-style forms that work with the GAE db.Model fields.
Alternatively, you can use django-nonrel... | 0 | 0 | 0 | 0 | 2012-12-19T18:10:00.000 | 1 | 1.2 | true | 13,958,475 | 0 | 0 | 1 | 1 | I have been leaning Django so I could use the Django admin form in my GAE application. I have just read that GAE doesn't support the django models so i am thinking that it also does not support the admin form.
So the question is does GAE support any other 'forms' or 'reports' environment or do you have to do everythin... |
Selenium Webdriver with Java vs. Python | 35,039,909 | 4 | 6 | 12,904 | 0 | java,python,selenium,webdriver | "If you're running selenium tests against a Java application, then it makes sense to drive your tests with Java." This is untrue. It makes no difference what the web application is written in.
Personally I prefer python because it's equally as powerful as other languages, such as Java, and far less verbose making c... | 0 | 0 | 1 | 0 | 2012-12-19T20:47:00.000 | 5 | 0.158649 | false | 13,960,897 | 0 | 0 | 1 | 5 | I'm wondering what the pros and cons are of using Selenium Webdriver with the python bindings versus Java. So far, it seems like going the java route has much better documentation. Other than that, it seems down to which language you prefer, but perhaps I'm missing something.
Thanks for any input! |
Selenium Webdriver with Java vs. Python | 13,992,922 | 0 | 6 | 12,904 | 0 | java,python,selenium,webdriver | It really does not matter. Even the Documentation. Selenium lib is not big at all.
Moreover, if you are good in development, you'll wrap selenium in your own code, and will never use driver.find(By.whatever(description)). Also you'd use some standards and By.whatever will become By.xpath only.
Personally, I prefer pyth... | 0 | 0 | 1 | 0 | 2012-12-19T20:47:00.000 | 5 | 0 | false | 13,960,897 | 0 | 0 | 1 | 5 | I'm wondering what the pros and cons are of using Selenium Webdriver with the python bindings versus Java. So far, it seems like going the java route has much better documentation. Other than that, it seems down to which language you prefer, but perhaps I'm missing something.
Thanks for any input! |
Selenium Webdriver with Java vs. Python | 13,961,695 | 0 | 6 | 12,904 | 0 | java,python,selenium,webdriver | For me it's just a language preference. There are bindings for other languages, but I believe they communicate with Webdriver via some sort of socket interface. | 0 | 0 | 1 | 0 | 2012-12-19T20:47:00.000 | 5 | 0 | false | 13,960,897 | 0 | 0 | 1 | 5 | I'm wondering what the pros and cons are of using Selenium Webdriver with the python bindings versus Java. So far, it seems like going the java route has much better documentation. Other than that, it seems down to which language you prefer, but perhaps I'm missing something.
Thanks for any input! |
Selenium Webdriver with Java vs. Python | 13,961,645 | 1 | 6 | 12,904 | 0 | java,python,selenium,webdriver | You've got it spot on, there are ton load of documents for Java. All the new feature implementations are mostly explained with Java. Even stackoverflow has a pretty strong community for java + selenium. | 0 | 0 | 1 | 0 | 2012-12-19T20:47:00.000 | 5 | 0.039979 | false | 13,960,897 | 0 | 0 | 1 | 5 | I'm wondering what the pros and cons are of using Selenium Webdriver with the python bindings versus Java. So far, it seems like going the java route has much better documentation. Other than that, it seems down to which language you prefer, but perhaps I'm missing something.
Thanks for any input! |
Selenium Webdriver with Java vs. Python | 13,961,711 | 2 | 6 | 12,904 | 0 | java,python,selenium,webdriver | Generally speaking, the Java selenium web driver is better documented. When I'm searching for help with a particular issue, I'm much more likely to find a Java discussion of my problem than a Python discussion.
Another thing to consider is, what language does the rest of your code base use? If you're running selenium... | 0 | 0 | 1 | 0 | 2012-12-19T20:47:00.000 | 5 | 1.2 | true | 13,960,897 | 0 | 0 | 1 | 5 | I'm wondering what the pros and cons are of using Selenium Webdriver with the python bindings versus Java. So far, it seems like going the java route has much better documentation. Other than that, it seems down to which language you prefer, but perhaps I'm missing something.
Thanks for any input! |
Web fonts always return 404 from static path | 23,329,676 | 0 | 1 | 350 | 0 | python,pyramid | Not sure if it's still relevant to the OP, but I hit the same problem.
The reason was that setup.py install simply didn't copy the font files, and the solution was to include all the font extensions in the MANIFEST.in file. | 0 | 0 | 0 | 0 | 2012-12-19T20:51:00.000 | 2 | 0 | false | 13,960,956 | 0 | 0 | 1 | 1 | I'm having trouble with a static view, it is configured to serve files from the 'assets' folder on the server, and works fine for the following '/assets/img/hdr.png','/assets/style/default.css' however when trying to serve a web font it always returns 404 not found (despite the fact I have triple checked the file is in... |
Django, where to update failed login attempts and why? | 13,964,128 | 1 | 2 | 1,638 | 0 | python,django,authentication | What: I would actually implement that logic in an Authentication Backend.
How: Use a specific, separate, Model to track login attempts, or, use the solution suggested by miko (fail2ban).
Why: You de-couple authentication from users. Bonus: if you want to take advantage of the upcoming pluggable User models in Django, ... | 0 | 0 | 0 | 0 | 2012-12-19T21:22:00.000 | 2 | 0.099668 | false | 13,961,409 | 0 | 0 | 1 | 2 | I have a custom user model where I want to track number of failed login attempts and take action based on that. I am wondering what would be a better place to write this logic.
Following are two options I have in mind for updating *failed_attempts* field in User model:
Autheticate method in the backend.
*check_passwo... |
Django, where to update failed login attempts and why? | 13,961,497 | 1 | 2 | 1,638 | 0 | python,django,authentication | Using only the details you list, I would say the Authentication method is more appropriate, if only because it would be very confusing if check_password updates fields on the model.
Why, though, do you have both an 'Authenticate method in the backed' and a check_password method in the model? | 0 | 0 | 0 | 0 | 2012-12-19T21:22:00.000 | 2 | 1.2 | true | 13,961,409 | 0 | 0 | 1 | 2 | I have a custom user model where I want to track number of failed login attempts and take action based on that. I am wondering what would be a better place to write this logic.
Following are two options I have in mind for updating *failed_attempts* field in User model:
Autheticate method in the backend.
*check_passwo... |
Can I parse xpath using python, selenium and lxml? | 40,276,743 | 0 | 1 | 1,853 | 0 | python,parsing,selenium,lxml,xpath | I prefer to use lxml. Because the efficiency of lxml is more higher than selenium for large elements extraction. You can use selenium to get source of webpages and parse the source with lxml's xpath instead of the native find_elements_with_xpath in selenium. | 0 | 0 | 1 | 0 | 2012-12-20T04:37:00.000 | 2 | 0 | false | 13,965,403 | 0 | 0 | 1 | 1 | So I have been trying to figure our how to use BeautifulSoup and did a quick search and found lxml can parse the xpath of an html page. I would LOVE if I could do that but the tutorial isnt that intuitive.
I know how to use Firebug to grab the xpath and was curious if anyone has use lxml and can explain how I can use i... |
Getting service unavailable error in scrapy crawling | 13,967,095 | 8 | 5 | 14,588 | 0 | python,scrapy | HTTP status code 503, "Service Unavailable", means that (for some reason) the server wasn't able to process your request. It's usually a transient error. I you want to know if you have been blocked, just try again in a little while and see what happens.
It could also mean that you're fetching pages too quickly. The fix... | 0 | 0 | 1 | 0 | 2012-12-20T05:09:00.000 | 2 | 1.2 | true | 13,965,684 | 0 | 0 | 1 | 1 | I am trying to crawl a forum website with scrapy.
The crawler works fine if I have
CONCURRENT_REQUESTS = 1
But if I increase that number then I get this error
2012-12-21 05:04:36+0800 [working] DEBUG: Retrying http://www.example.com/profile.php?id=1580> (failed 1 times): 503
Service Unavailable
I want to know if th... |
ropemacs on windows with django project is very slow | 14,254,108 | 0 | 0 | 158 | 0 | python,django,windows,emacs,ropemacs | As i wrote in the comments and as David said, I resorted to using Jedi. | 0 | 0 | 0 | 0 | 2012-12-20T16:38:00.000 | 3 | 1.2 | true | 13,976,625 | 0 | 0 | 1 | 1 | In a newly created Django project I'm using ropemacs to get semantic completions and refactoring functionality. But it seems that everytime I enter a character that triggers a completion list check, the buffer freezes for about a second, sometimes two.
I heard that ropemacs can be slow on big projects, but is a fresh ... |
Detect change of browser tabs with javascript | 13,989,768 | 2 | 6 | 3,555 | 0 | javascript,browser,python-idle | Trap the window.onblur event.
It's raised whenever the current window (or tab) loses focus. | 0 | 0 | 1 | 0 | 2012-12-21T11:56:00.000 | 3 | 1.2 | true | 13,989,737 | 0 | 0 | 1 | 2 | is there some way of detecting using javascript that a user has switched to a different tab in the same browser window.
Additionally is there a way to detect a user has switched to a different window than the browser?
thank you |
Detect change of browser tabs with javascript | 13,989,766 | 1 | 6 | 3,555 | 0 | javascript,browser,python-idle | Most probably there is no standards javascript for this. Some browsers might support it but normally there is only a window.onblur event to find out the user has gone away from the current window. | 0 | 0 | 1 | 0 | 2012-12-21T11:56:00.000 | 3 | 0.066568 | false | 13,989,737 | 0 | 0 | 1 | 2 | is there some way of detecting using javascript that a user has switched to a different tab in the same browser window.
Additionally is there a way to detect a user has switched to a different window than the browser?
thank you |
What class file to create for a link model used for many to many relasionship in google app engine | 13,992,083 | 3 | 0 | 38 | 0 | python,google-app-engine | It makes absolutely no difference.
Firstly, however, you should realize that there's no need to have a separate file for each model. It's perfectly normal to have several model classes in one models.py file. The division is between separate apps, each of which group together related models.
Secondly, you should also re... | 0 | 0 | 0 | 0 | 2012-12-21T14:24:00.000 | 1 | 1.2 | true | 13,991,871 | 0 | 0 | 1 | 1 | I have 2 models: a and b
I want to build a many to many relashionship and I will use the link model method, thus I need to create an a_to_b_membership model.
The question is:
Should I put the model class on the a model file?
The b model file?
Or create a new model file?
If I need to create a new model file, then ho... |
PyQt - Automatically refresh a custom view when the model is updated? | 14,000,161 | 0 | 3 | 5,032 | 0 | python,qt,user-interface,qt4,pyqt | You need to connect your view to the dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight ) signal of the model:
This signal is emitted whenever the data in an existing item changes.
If the items are of the same parent, the affected ones are those
between topLeft and bottomRight inclusive. If t... | 1 | 0 | 0 | 0 | 2012-12-22T04:07:00.000 | 2 | 1.2 | true | 13,999,970 | 0 | 0 | 1 | 1 | By default, the built-in views in PyQt can auto-refresh itself when its model has been updated. I wrote my own chart view, but I don't know how to do it, I have to manually update it for many times.
Which signal should I use? |
Repeatably gzip files in python | 14,004,771 | 2 | 1 | 486 | 0 | python,gzip | The compressed data is the same each time. The only thing that differs is likely the modification time in the header. The fifth argument of GzipFile (if that's what you're using) allows you to specify the modification time in the header. The first argument is the file name, which also goes in the header, so you want... | 0 | 0 | 0 | 0 | 2012-12-22T11:15:00.000 | 2 | 1.2 | true | 14,002,357 | 0 | 0 | 1 | 1 | I'm writing a script in python for deploying static sites to aws (s3, cloudfront, route53). Because I don't want to upload every file on every deploy, I check which files were modified by comparing their md5 hash with their e-tag (which s3 sets to be the object's md5 hash). This works well for all files except for thos... |
File path encoding in Windows | 14,003,444 | 1 | 0 | 1,880 | 0 | python,windows | Use sys.getfilesystemencoding().
That should allow you to convert all paths that look ok.
However, there can always be illegally-encoded files or folders, you have to think how to deal with those in the framework of your application.
Some apps may ignore such files, others keep name as a binary blob. | 0 | 0 | 0 | 0 | 2012-12-22T13:51:00.000 | 1 | 0.197375 | false | 14,003,386 | 0 | 0 | 1 | 1 | I'm writing a small application which saves file paths to a database (using django). I assumed file paths are utf-8 encoded, but I ran into the following file name: C:\FXG™.nfo which is apparently not encoded in utf-8.
When I do filepath.decode('utf-8') I get the following error:
UnicodeDecodeError: 'utf8' codec can't... |
How to generate sound signal through a GPIO pin on BeagleBone | 14,008,119 | 1 | 2 | 4,148 | 0 | python,audio,beagleboard | The GPIO pins of the AM3359 are low-voltage and with insufficient driver strength to directly drive any kind of transducer. You would need to build a small circuit with a op-amp, transistor or FET to do this.
Once you've done this, you'd simply set up a timer loop to change the state of the GPIO line at the required f... | 0 | 0 | 0 | 1 | 2012-12-23T01:28:00.000 | 3 | 0.066568 | false | 14,007,965 | 0 | 0 | 1 | 1 | I am looking for pointers/tips on how to generate a synthesized sound signal on the BeagleBone akin to watch the tone() function would return on a Arduinos. Ultimately, I'd like to connect a piezo or a speaker on a GPIO pin and hear a sound wave out of it. Any pointers? |
Storing MySQL Passwords | 14,008,320 | 1 | 2 | 408 | 1 | python,mysql,django,security,encryption | Your question embodies a contradiction in terms. Either you don't want reversibility or you do. You will have to choose.
The usual technique is to hash the passwords and to provide a way for the user to reset his own password on sufficient alternative proof of identity. You should never display a password to anybody, f... | 0 | 0 | 0 | 0 | 2012-12-23T02:46:00.000 | 2 | 0.099668 | false | 14,008,232 | 0 | 0 | 1 | 2 | So, a friend and I are currently writing a panel (in python/django) for managing gameservers.
Each client also gets a MySQL server with their game server. What we are stuck on at the moment is how clients will find out their MySQL password and how it will be 'stored'.
The passwords would be generated randomly and prese... |
Storing MySQL Passwords | 14,008,264 | 4 | 2 | 408 | 1 | python,mysql,django,security,encryption | Though this is not the answer you were looking for, you only have three possibilities
store the passwords plaintext (ugh!)
store with a reversible encryption, e.g. RSA (http://stackoverflow.com/questions/4484246/encrypt-and-decrypt-text-with-rsa-in-php)
do not store it; clients can only reset password, not view it
Th... | 0 | 0 | 0 | 0 | 2012-12-23T02:46:00.000 | 2 | 1.2 | true | 14,008,232 | 0 | 0 | 1 | 2 | So, a friend and I are currently writing a panel (in python/django) for managing gameservers.
Each client also gets a MySQL server with their game server. What we are stuck on at the moment is how clients will find out their MySQL password and how it will be 'stored'.
The passwords would be generated randomly and prese... |
What is it called, to extract an address from HTML via NLP | 14,085,942 | 1 | 2 | 2,336 | 0 | python,nlp,nltk | Strip the text out of the HTML page (unless there is a way from the HTML to identify the address text such as div with a particular class) then build a set of rules that match the address formats used.
If there are postal addresses in several countries then the formats may be markedly different but within a country, t... | 0 | 0 | 0 | 0 | 2012-12-23T10:40:00.000 | 4 | 0.049958 | false | 14,010,297 | 0 | 0 | 1 | 1 | I have 300k+ html documents, which I want to extract postal addresses from. The data is different structures, so regex wont work.
I have done a heap of reading on NLP and NLTK for python, however I am still struggling on where to start with this.
Is this approach called Part-of-Speech Tagging or Chunking / Partial Pars... |
Redirect and requests in flask microframework | 14,011,846 | 1 | 0 | 223 | 0 | python,http,redirect,response,flask | If you return redirect('someurl') in your view function it will result in a Location header being sent to the client. So unless the client decides to load the target from cache instead the view function of the target URL will be executed just like if the client accessed it directly. | 0 | 0 | 0 | 0 | 2012-12-23T14:37:00.000 | 1 | 0.197375 | false | 14,011,819 | 0 | 0 | 1 | 1 | Is there any difference in the way redirects and requests are handled in the flask micro-framework? I have a bunch of functions which are to be run before a request is made but apparently they are not being run whenever there is a redirect to another url. |
synchronizing file names across servers | 14,013,487 | 0 | 0 | 67 | 0 | python,django,linux,deployment | If the names on the development and production server are the same, then record the rename commands in a shell-script.
You can run that on both the development and the production server... | 0 | 0 | 0 | 0 | 2012-12-23T17:49:00.000 | 1 | 0 | false | 14,013,214 | 0 | 0 | 1 | 1 | I have a development & production server and some large video files. The large files need to be renamed. I don't know how to automatically change the file names in the production environment when I change their name in the development environment. I think using git is very inefficient for large files.
On the developmen... |
Web2Py minimal User authentication (username only) | 14,202,881 | 1 | 1 | 3,519 | 0 | python,database,authentication,web2py | web2py by default allows blank passwords. So simply hide the password fields in the login and registration forms using CSS. You should be able to use the default auth. | 0 | 0 | 0 | 0 | 2012-12-25T05:40:00.000 | 3 | 0.066568 | false | 14,028,015 | 0 | 0 | 1 | 1 | I did not find anything on the web and so I'm asking here.
Is there a way to create a custom auth wich only requires a username? That means to login to a specific subpage one has only to enter a username, no email and no password etc.?
Or is there a better way to do this? E.g. a subpage can only be accessed if the user... |
What is the best way in python/django to let users add files to the database? | 14,047,603 | 0 | 0 | 101 | 0 | python,html,django,url-routing | You could simply write static files to disc, and then serve them as static files. That would be easier, but it depends on your other requirements.
But, from what I understand in your question you'd need:
A form to upload
A upload handler itself which inserts into the db
A view that renders based on a path
Not sure ab... | 0 | 0 | 0 | 0 | 2012-12-26T23:06:00.000 | 1 | 1.2 | true | 14,047,401 | 0 | 0 | 1 | 1 | I am trying to let users create html pages that they can view on my website. So the homepage would just have a place for file upload, then some script on my site would take the file and convert it into the html page and place it at mysite.com/23klj4d(identifying file name). From my understanding, this would mean that t... |
How to make a standalone app like a website form? | 14,051,044 | 0 | 0 | 318 | 0 | python,django,user-interface,django-forms | If I understand your requirement, you want to create UI for a Form. Also, you don't want to use browser. Then you have lots of options. Django is web-framework. You can avoid it. Simply create a UI with WxPython or PyQt (I recommend to use this) or TkInter etc. Do a google search for tutorials. | 0 | 0 | 0 | 0 | 2012-12-27T06:24:00.000 | 2 | 1.2 | true | 14,050,356 | 0 | 0 | 1 | 1 | I would like to create a small app that would be like a form on a website, but just for local files. I'm not really sure where to start (Django or other) or what to use, but I'd like to start with the GUI.
What would be the best way to create a program like this? Can I use Django to create a form that would not be used... |
Is there anyway to view memcache data in google app engine? | 14,051,678 | 0 | 1 | 444 | 0 | python,google-app-engine,memcached | What's wrong with the memcache viewer in the admin console? | 0 | 1 | 0 | 0 | 2012-12-27T07:02:00.000 | 2 | 0 | false | 14,050,745 | 0 | 0 | 1 | 1 | Basically what I want to do is see the raw data of memcache so that I can see how my data are being stored. |
redis celeryd and apache | 14,061,333 | 2 | 0 | 130 | 0 | python,django,redis,celery | Provided you're running Daemon processes of Redis and Celery you do not need to restart them when you restart Apache.
Generally, you will need to restart them when you make configuration changes to either Redis or Celery as the applications are dependent on eachother. | 0 | 1 | 0 | 0 | 2012-12-27T21:05:00.000 | 1 | 1.2 | true | 14,061,297 | 0 | 0 | 1 | 1 | I'm a bit new to redis and celery. Do I need to restart celeryd and redis every time I restart apache? I'm using celery and redis with a django project hosted on webfaction.
Thanks for the info in advance. |
Which python web frameworks incorporate a web sever that is suitable for production use? | 14,063,549 | 1 | 0 | 232 | 0 | python,frameworks | I find Django's admin very easy to use for non-technical clients. In fact, that is the major consideration for my using Django as of late. Once set up properly, non-technical people can very easily update information, which can reflected on the front end immediately.
The client feels empowered. | 0 | 0 | 0 | 0 | 2012-12-28T01:37:00.000 | 2 | 1.2 | true | 14,063,516 | 0 | 0 | 1 | 2 | I need to write a very light database (sqlite is fine) app that will initially be run locally on a clients windows PC but could, should it ever be necessary, be upgraded to work over the public interwebs without a complete rewrite.
My end user is not very technically inclined and I'd like to keep things as simple as po... |
Which python web frameworks incorporate a web sever that is suitable for production use? | 14,069,017 | 0 | 0 | 232 | 0 | python,frameworks | Use Django. It's very simple for you to get started. Also, they have the best documentation. Follow the step by step app creating tutorial. Django supports all the databases that exist. Also, the built in server is very simple to use for the development and production server. I would highly recommend Django. | 0 | 0 | 0 | 0 | 2012-12-28T01:37:00.000 | 2 | 0 | false | 14,063,516 | 0 | 0 | 1 | 2 | I need to write a very light database (sqlite is fine) app that will initially be run locally on a clients windows PC but could, should it ever be necessary, be upgraded to work over the public interwebs without a complete rewrite.
My end user is not very technically inclined and I'd like to keep things as simple as po... |
python: why a File object cannot be pickled? | 14,063,752 | 4 | 0 | 465 | 0 | python,django | Python does not allow pickling of some functions either, because of security problems if it were to be allowed. (It depends - there are ways to pickle some functions by reference)
Pickling file objects has been requested in the features threads of python many times, and the best reasoning is because it opens up additio... | 0 | 0 | 0 | 0 | 2012-12-28T02:07:00.000 | 1 | 1.2 | true | 14,063,712 | 0 | 0 | 1 | 1 | I am trying to understand why sending a django InMemoryUploadedFile object cannot be pickled when sending it as an argument of a celery task, Can't pickle <type 'cStringIO.StringO'>: attribute lookup cStringIO.StringO failed. So i tried out the File object, doesn't work as well, but a StringIO would work.
Need some dum... |
Collectstatic command is not available in Django 1.4 | 14,071,410 | 12 | 4 | 3,442 | 0 | python,django,python-2.7 | Check settings.py for django.contrib.staticfiles in INSTALLED_APPS and django.core.context_processors.static in TEMPLATE_CONTEXT_PROCESSORS | 0 | 0 | 0 | 0 | 2012-12-28T14:50:00.000 | 2 | 1.2 | true | 14,071,294 | 0 | 0 | 1 | 2 | So I'm trying to run collectstatic to push some files to AWS, but I keep getting a "unknown command" error. When running manage.py help I get a list of subcommands, and sure enough collectstatic is not there. I have looked also in the installed apps part of settings.py and the staticfiles app is installed. Python is ve... |
Collectstatic command is not available in Django 1.4 | 18,474,545 | 4 | 4 | 3,442 | 0 | python,django,python-2.7 | For those for whom the accepted answer did not work, doing
python manage.py collectstatic
worked while
python django-admin.py collecstatic did not.
Maybe that can help some. | 0 | 0 | 0 | 0 | 2012-12-28T14:50:00.000 | 2 | 0.379949 | false | 14,071,294 | 0 | 0 | 1 | 2 | So I'm trying to run collectstatic to push some files to AWS, but I keep getting a "unknown command" error. When running manage.py help I get a list of subcommands, and sure enough collectstatic is not there. I have looked also in the installed apps part of settings.py and the staticfiles app is installed. Python is ve... |
Good way to make a SQL based activity feed faster | 14,074,169 | 1 | 4 | 499 | 1 | python,sql,django,redis,feed | You said redis? Everything is better with redis.
Caching is one of the best ideas in software development, no mather if you use Materialized Views you should also consider trying to cache those, believe me your users will notice the difference. | 0 | 0 | 0 | 0 | 2012-12-28T17:04:00.000 | 3 | 0.066568 | false | 14,073,030 | 0 | 0 | 1 | 2 | Need a way to improve performance on my website's SQL based Activity Feed. We are using Django on Heroku.
Right now we are using actstream, which is a Django App that implements an activity feed using Generic Foreign Keys in the Django ORM. Basically, every action has generic foreign keys to its actor and to any obje... |
Good way to make a SQL based activity feed faster | 14,201,647 | 1 | 4 | 499 | 1 | python,sql,django,redis,feed | Went with an approach that sort of combined the two suggestions.
We created a master list of every action in the database, which included all the information we needed about the actions, and stuck it in Redis. Given an action ID, we can now do a Redis look up on it and get a dictionary object that is ready to be retur... | 0 | 0 | 0 | 0 | 2012-12-28T17:04:00.000 | 3 | 1.2 | true | 14,073,030 | 0 | 0 | 1 | 2 | Need a way to improve performance on my website's SQL based Activity Feed. We are using Django on Heroku.
Right now we are using actstream, which is a Django App that implements an activity feed using Generic Foreign Keys in the Django ORM. Basically, every action has generic foreign keys to its actor and to any obje... |
Google App Engine - Upgrading from App Engine Helper | 14,079,702 | 1 | 0 | 91 | 0 | python,django,google-app-engine | You can use Django 1.4 with CloudSQL.
If you're using the HRD, you'd want to use django-nonrel (the successor to App Engine Helper).
While django-nonrel works, the documentation is a bit lacking at the moment. | 0 | 1 | 0 | 0 | 2012-12-29T04:15:00.000 | 1 | 1.2 | true | 14,078,640 | 0 | 0 | 1 | 1 | I would like to remove dependencies on the old-style App Engine Helper for Django in my Python-based App-Engine application . At the same time, I would like to upgrade to Python2.7 and Django1.4. I have a few questions about the upgrade process:
1) The new App Engine SDK (Version 1.7.4) states that Django is fully supp... |
django import project.app vs import app | 14,078,822 | 1 | 0 | 345 | 0 | python,django,import | from catalog.models import Product is fine, and i think it's better than the example. Because if you want to use the app, you have to change every single import statement where you use your project name. Don't do from myproject.myapp.models import MyModel, it's a bad practice, if you're sure that the models you importi... | 0 | 0 | 0 | 0 | 2012-12-29T04:41:00.000 | 2 | 0.099668 | false | 14,078,762 | 0 | 0 | 1 | 1 | I am going through another django tutorial and I noticed for the imports the author uses
from project.app.file import item but this doesnt work unless I do
from app.file import item
Example:
Authors version:
from ecomstore.catalog.models import Product
which doesnt work
Error: ImportError: No module named catalog.mod... |
Is it time to use Django 1.5? | 14,079,421 | 3 | 4 | 1,665 | 0 | python,django | Django 1.5 is going to be released very soon. You can start using now. | 0 | 0 | 0 | 0 | 2012-12-29T06:33:00.000 | 2 | 0.291313 | false | 14,079,327 | 0 | 0 | 1 | 1 | I'm new to Django (coming from PHP Yii), and I want to learn it by developing some web site. Should I write it on Django 1.4 or 1.5?
If you had to develop a new (production) web site now, would you use Django 1.5? |
How do I know a page is really fully loaded? | 14,094,212 | 4 | 6 | 218 | 0 | javascript,python,webview,webkit,web-crawler | There is no real way to determine if that page is fully loaded.
One method is to determine the amount of time since the last request. However, some pages will make repeated requests continually. This is common with tracking scripts and some ad scripts.
What I would do is use a set amount of time after the web view ha... | 1 | 0 | 0 | 0 | 2012-12-30T19:26:00.000 | 1 | 1.2 | true | 14,093,870 | 0 | 0 | 1 | 1 | I am using python webkit.WebView and gtk to crawl a web page. However, the web page is kind of dynamically loaded by javascript.
The WebView "load-finished" event is not sufficient to handle this. Is there any indicator/event to let me know that the page is really fully loaded even the content produced by javascript?
... |
Compare two rows in a one2many table in OpenERP6.1 | 14,102,667 | 0 | 2 | 467 | 0 | python,openerp | Why cant you use _constraint? You will only get warning when you are saving the record. | 0 | 0 | 0 | 0 | 2012-12-31T11:09:00.000 | 2 | 0 | false | 14,100,792 | 0 | 0 | 1 | 1 | How can we compare two rows in a oneTomany table in OpenERP6.1?
I have a main table, say 'XX' and i have a oneTomany table, say 'YY' corresponding to
that table.
Now, i have three columns in the 'YY' table.Every time i create records into
this table, i want to check if the values in the three columns are identical.
i.e... |
How do I run South migrations (Django) on a database server? | 14,116,934 | 1 | 0 | 101 | 0 | python,mysql,database,django,django-south | It doesn't matter if the database is running on the same machine as django/South. Wherever your django installation lives has the database configured in its settings. South migrations should work exactly the same. | 0 | 0 | 0 | 0 | 2013-01-02T04:40:00.000 | 1 | 1.2 | true | 14,116,907 | 0 | 0 | 1 | 1 | Originally, I've just had servers that have both Django, South and my database installed (web + database server combined). But now, we're moving to a dedicate database server, and a dedicate web app server.
Since the database server doesn't have Django or South installed, how can I run migrations? Or at least, what's t... |
Where is the value stored for a one2many table initially in OpenERP6.1 | 14,119,351 | 2 | 2 | 1,493 | 1 | python,openerp | When saving a new record in openerp, a dictionary will be generated with all the fields having data as keys and its data as values. If the field is a one2many and have many lines, then a list of dictionaries will be the value for the one2many field. You can modify it by overriding the create and write functions in open... | 0 | 0 | 0 | 0 | 2013-01-02T08:57:00.000 | 3 | 0.132549 | false | 14,119,208 | 0 | 0 | 1 | 2 | I would like to know as to where is the value stored for a one2many table initially in OpenERP6.1?
i.e if we create a record for a one2many table,this record will be actually
saved to the database table only after saving the record of the main table
associated with this, even though we can create many records(rows) for... |
Where is the value stored for a one2many table initially in OpenERP6.1 | 14,120,545 | 0 | 2 | 1,493 | 1 | python,openerp | One2Many field is child parent relation in OpenERP. One2Many is just logical field there is no effect in database for that.
If you are creating Sale order then Sale order line is One2Many in Sale order model. But if you will not put Many2One in Sale order line then One2Many in Sale order will not work.
Many2One field p... | 0 | 0 | 0 | 0 | 2013-01-02T08:57:00.000 | 3 | 0 | false | 14,119,208 | 0 | 0 | 1 | 2 | I would like to know as to where is the value stored for a one2many table initially in OpenERP6.1?
i.e if we create a record for a one2many table,this record will be actually
saved to the database table only after saving the record of the main table
associated with this, even though we can create many records(rows) for... |
bad operand type for abs(): 'str' in django | 18,424,335 | 0 | 1 | 15,930 | 0 | django,python-2.7,django-templates | I think your are writing the code from "beginning Django E-commerce" book.
The error is in your code you write {{ cart_sutotal|currency }} in place of {{ cart_subtotal }} . | 0 | 0 | 0 | 0 | 2013-01-02T10:43:00.000 | 5 | 0 | false | 14,120,640 | 0 | 0 | 1 | 3 | I am going through the beginning django ecommerce application for shopping cart app. I am getting the error as mentioned above while clicking the add to cart button.
I am getting the error at the line {{ cart_sutotal|currency}} |
bad operand type for abs(): 'str' in django | 14,121,826 | 1 | 1 | 15,930 | 0 | django,python-2.7,django-templates | The currency filter expects its argument to be a numeric value; you're passing a string to your template as cart_sutotal.
Before passing it to the template, convert it to a decimal.Decimal, or, better, figure out why you're adding up price values and coming up with a string for the subtotal. | 0 | 0 | 0 | 0 | 2013-01-02T10:43:00.000 | 5 | 0.039979 | false | 14,120,640 | 0 | 0 | 1 | 3 | I am going through the beginning django ecommerce application for shopping cart app. I am getting the error as mentioned above while clicking the add to cart button.
I am getting the error at the line {{ cart_sutotal|currency}} |
bad operand type for abs(): 'str' in django | 14,120,681 | 0 | 1 | 15,930 | 0 | django,python-2.7,django-templates | You are missing a cast somewhere in your code.
Wherever in the code you're doing abs(somevar) you need to cast a string to an integer by doing abs(int(somevar)). More info if you post a stacktrace or pieces of code. | 0 | 0 | 0 | 0 | 2013-01-02T10:43:00.000 | 5 | 0 | false | 14,120,640 | 0 | 0 | 1 | 3 | I am going through the beginning django ecommerce application for shopping cart app. I am getting the error as mentioned above while clicking the add to cart button.
I am getting the error at the line {{ cart_sutotal|currency}} |
How to convert a html page to pdf in Django | 14,161,687 | 0 | 1 | 2,954 | 0 | python,html,django,pdf,phantomjs | Okay, after whole lot googling, I couldn't find anything. So I came up with two hackish solutions.
On the page which user is viewing, create a form with a hiding text area, the submit button is named 'Generate PDF', after rendering the page, I use JavaScript to get all the html within the divs I want and put them int... | 0 | 0 | 0 | 0 | 2013-01-03T11:12:00.000 | 4 | 1.2 | true | 14,137,778 | 0 | 0 | 1 | 1 | I am using Django to create a report site. The reports are generated dynamically, they also include some SVG charts. I want to create a PDF file which is based on the current report the user is viewing, but with extra header and footer. I came across Phantomjs, two problems though, first is that the page requires user ... |
How to load custom packages from inside Django apps into views.py? | 14,147,669 | 0 | 1 | 1,150 | 0 | django,model-view-controller,python-3.x,django-views,three-tier | If Class1 or parser import from views, then you have a circular dependency. You'll need to move any shared code out into a third file.
You might consider though whether you need all those separate files under logic. In Python there's no requirement to have a class in its own file, so maybe you could have a single logic... | 0 | 0 | 0 | 0 | 2013-01-03T19:21:00.000 | 1 | 0 | false | 14,145,677 | 0 | 0 | 1 | 1 | I am new to Django and have a little problem with making all the project structure clear and organized and so on.. The MVC stuff in Django is quite easy to use when making a small project. However, when I am trying to get a new layer (application logic, like three-tier architecture) between views.py and models.py I hav... |
HA deploy for Python wsgi application | 14,148,902 | 0 | 2 | 2,227 | 0 | python,nginx,wsgi,haproxy | Of the three options, only option number 1 has any chance of working with websockets. Nginx, and most standard webservers will not play nicely with them. | 0 | 1 | 0 | 0 | 2013-01-03T20:34:00.000 | 2 | 0 | false | 14,146,814 | 0 | 0 | 1 | 1 | I consider this scenarios for deploying High Available Python web apps:
load balancer -* wsgi servers
load balancer -* production HTTP sever - wsgi server
production HTTP sever (with load balancing features, like Nginx) -* wsgi servers
For load balancer I consider HAProxy
For production HTTP sever I consider Nginx
... |
Creating year dropdown in Django template | 14,152,733 | 0 | 2 | 10,836 | 0 | python,django,django-templates | I would suggest to use Javascript or jQuery at client side to populate the dropdown according to the current year. | 0 | 0 | 0 | 0 | 2013-01-04T06:41:00.000 | 5 | 0 | false | 14,152,389 | 0 | 0 | 1 | 1 | I want to create a year dropdown in django template. The dropdown would contain start year as 2011, and end year should be 5 years from current year.
For ex: If today i see the dropdwon it will show me years ranging from 2011, 2012, 2013,...2017.
It can be done by sending a list from views.py and looping it in the temp... |
Why should I use `mod_wsgi` instead of launching by python? | 14,152,716 | 4 | 1 | 82 | 0 | python,django,apache,mod-wsgi,wsgi | Since I answered your other question regarding Flask, I assume you are referring to using Flask's development server. The problem with that is it is single threaded.
Using mod_wsgi, you would be running behind apache, which will do process forking and allow for multiple simultaneous requests to be handled.
There are o... | 0 | 0 | 0 | 1 | 2013-01-04T07:02:00.000 | 1 | 0.664037 | false | 14,152,651 | 0 | 0 | 1 | 1 | I was wondering what is the advantages of mod_wsgi. For most python web framework, I can launch (daemon) the application by python directly and serve it in a port. Then when shall I use mod_wsgi? |
What is a main reason that Django webserver is blocking? | 14,158,864 | 5 | 3 | 176 | 0 | python,django,webserver,tornado,blocking | I believe It is single threaded and blocking so it is easy to debug. if you put a debugger in it will completely halt the server | 0 | 1 | 0 | 0 | 2013-01-04T14:19:00.000 | 2 | 1.2 | true | 14,158,844 | 0 | 0 | 1 | 2 | Why is the Django webserver blocking, not non-blocking like Tornado? Was there a reason to design the webserver in this way? |
What is a main reason that Django webserver is blocking? | 14,159,011 | 5 | 3 | 176 | 0 | python,django,webserver,tornado,blocking | If you really need another reason on top of that suggested by dm03514, it I'd probably simply because it was easier to write. Since the dev server I'd for development only, little effort was spent in making it more complex or able to serve multiple requests. In fact, this is an explicit goal: making it any better would... | 0 | 1 | 0 | 0 | 2013-01-04T14:19:00.000 | 2 | 0.462117 | false | 14,158,844 | 0 | 0 | 1 | 2 | Why is the Django webserver blocking, not non-blocking like Tornado? Was there a reason to design the webserver in this way? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.