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
Best practice to handle global 500 errors in Django?
11,860,808
0
0
2,163
0
python,django
okay, now I understand how Http404 works. So you have to define this Http500 exception somewhere, and catch it in middleware.
0
0
0
0
2011-04-15T09:36:00.000
2
1.2
true
5,674,902
0
0
1
1
I have a django app running with MySQL and Redis as backend I have a function called redis_helper() to do redis queries. But sometimes Redis crash and needs sometime to bootup, so I need to return a friendly HTTP 500 error message. The problem is, django only defines Http404(Exception) class in django/http/__init__.py, not Http500(), so I have to manually add try ... except in every view function where redis_helper() was involved. It feel a bit ugly and repeating work. Are there any convenient way to raise server 500 error not using return HttpResponseServerError() in view functions? If I have to write Http500 class myself which file is the best place to write it? Regards and thank you!
Parsing html content with python and modifying it
5,675,635
1
1
606
0
python,html,beautifulsoup
Read the BeautifulSoup documentation - and come back if you have real issues.
0
0
1
0
2011-04-15T10:42:00.000
2
0.099668
false
5,675,531
0
0
1
1
I am new to python and i don't know many things.I want to parse an html page,modify it and show it in my own page.I try use beautifulsoup in order to parse html but some errors are generated.I searched on the web but i don't know any specific way to do this.Can anyone help me?
Django Debug Toolbar Only Working for Admin Section
5,685,316
4
8
4,781
0
python,django,django-debug-toolbar
A few tipps without knowing your code: 'debug_toolbar.middleware.DebugToolbarMiddleware' should be your last or second to last middle ware entry (not 100% sure how it works out with the flatpagefallback middleware) 'debug-toolbar' as last in the list of INSTALLED_APPS Double check if the toolbar's assets are loaded Make sure all toolbar settings are set. (DEBUG_TOOLBAR_CONFIG, INTERNAL_IPS) etc. The error should be something in there. I know of other problems related getting the toolbar displayed on flatpages so if you only checked on flatpages I suggest you try it on another module.
0
0
0
0
2011-04-16T05:59:00.000
7
0.113791
false
5,684,798
0
0
1
3
Hey, I've been using Django 1.2.1 for some time now and came across Django Debug Toolbar just the other day. It looks really useful and I'm really eager to try some stuff out. I installed exactly how the readme said. Step by Step. I put the middleware at the end just in case things get caught up but I'm using quite standard middleware (common, sessions, auth and csrf). However, it won't show up on any of my pages. I've tried moving the middleware but to the same effect. It seems as if I've installed something wrong. But, when I load up the Admin Section of django, the toolbar springs up. I'm not sure what I'm doing wrong. Can the content of my pages effect the toolbar coming up? It's outputting in the mime text/html... Anyway, any help is greatly appreciated. Thanks in advance. Here's my Settings.py: pastebin.com/Hu8TgANt
Django Debug Toolbar Only Working for Admin Section
15,992,979
0
8
4,781
0
python,django,django-debug-toolbar
In my case the error was very simple. I removed the footer and it worked like a charm! Hope this solves an issue for somebody else.
0
0
0
0
2011-04-16T05:59:00.000
7
0
false
5,684,798
0
0
1
3
Hey, I've been using Django 1.2.1 for some time now and came across Django Debug Toolbar just the other day. It looks really useful and I'm really eager to try some stuff out. I installed exactly how the readme said. Step by Step. I put the middleware at the end just in case things get caught up but I'm using quite standard middleware (common, sessions, auth and csrf). However, it won't show up on any of my pages. I've tried moving the middleware but to the same effect. It seems as if I've installed something wrong. But, when I load up the Admin Section of django, the toolbar springs up. I'm not sure what I'm doing wrong. Can the content of my pages effect the toolbar coming up? It's outputting in the mime text/html... Anyway, any help is greatly appreciated. Thanks in advance. Here's my Settings.py: pastebin.com/Hu8TgANt
Django Debug Toolbar Only Working for Admin Section
5,755,603
3
8
4,781
0
python,django,django-debug-toolbar
I had the same problem here, and eventually arrived at this post... Anyway, in my case what I noticed was that I had a javascript error in one of my js included libraries. And that breaked the js interpretation flow. When I fixed the javascript error, the django toolbar worked. That explains why it worked in the admin pages, but not in my app pages.
0
0
0
0
2011-04-16T05:59:00.000
7
0.085505
false
5,684,798
0
0
1
3
Hey, I've been using Django 1.2.1 for some time now and came across Django Debug Toolbar just the other day. It looks really useful and I'm really eager to try some stuff out. I installed exactly how the readme said. Step by Step. I put the middleware at the end just in case things get caught up but I'm using quite standard middleware (common, sessions, auth and csrf). However, it won't show up on any of my pages. I've tried moving the middleware but to the same effect. It seems as if I've installed something wrong. But, when I load up the Admin Section of django, the toolbar springs up. I'm not sure what I'm doing wrong. Can the content of my pages effect the toolbar coming up? It's outputting in the mime text/html... Anyway, any help is greatly appreciated. Thanks in advance. Here's my Settings.py: pastebin.com/Hu8TgANt
how do you install django older version using easy_install?
21,246,463
5
8
12,466
0
python,django,virtualenv
Since the question was about easy_install, it's useful to know that (with setuptools v2.1) you can specify version numbers with easy_install like you can with pip. Thus: $ easy_install django==1.3 will install django 1.3. This was important for my problem (which Google directed me here to solve), when I needed to install an old version of pip with easy install. Obviously "just install pip and do it there" doesn't work for that problem.
0
0
0
0
2011-04-16T16:51:00.000
3
0.321513
false
5,688,053
1
0
1
1
I just broke my environment because of django 1.3. None of my sites are able to run. So, i decided to use virtualenv to set virtual environment with different python version as well as django. But, seems like if i download the package and install using "sudo python setup.py install" this does not get added to my virtual environment, but my original environment. I tried "easy_install django" in virtual environment virtualenv_name/bin folder, and it worked, but the problem is django1.3 was chosen automatically and got added. I want to install django 1.2.5, is there a way that i can install easily to my virtual env?
Google App Engine: How to get the offset of an object
5,691,077
2
0
157
0
python,database,google-app-engine
Why not query the data twice? Once for users with a higher score, in descending order. Once for users with a lower score. Fetch five records in each query.
0
1
0
0
2011-04-16T16:54:00.000
2
0.197375
false
5,688,079
0
0
1
1
I am using Google App Engine in Python. In My database, I have some Entity which contain score of user. So I wanted to make a page on the ranking of a particular user. To do that, I need to get the 5 user with the higher score than that user and 5 user with lower score than that user, and also the position of that particular user in the database. I could use the cursor() method to get the encoded cursor. But, I cannot get the 5 Entity before the user's identity and even so, I cannot get the position of the user in the database. Maybe I can use the offset to do the query, but How to get the offset of an Entity?
Using django-facebook to display text on facebook canvas
21,381,966
0
2
1,073
0
python,django,django-facebook
Yeah, very though question. As first advice i suggest you to be sure that you have SSL enabled on the webserver that serve the canvas service. After that you will able to serve static files as canvas page, but not a django view. It is possible but i'm not able to find a workaround.
0
0
0
0
2011-04-17T18:21:00.000
2
0
false
5,695,455
0
0
1
1
I am practicing using django-facebook to integrate my django app with facebook and turn it into a facebook app. The documentation for django-facebook is very bad but I have managed to get my sample app to load the facebook canvas page. But I am unable to display anything on the canvas page. Any advice or suggestions would be appreciated. Sorry if this question is a little vague or unclear. Please let me know if I can clarify something. Cheers
web.py and flask
5,695,723
43
28
7,454
0
python,flask,web.py
Flask is a new and a very active project with good documentation and guidelines for new development and plugins. Its community is quite large and Armin (the lead) is an A grade programmer. Hence it is definitely the better contender. Web.py is an older and more mature project which is more a library than a framework. It's what we use for the Internet Archives Open Library website. The documentation is spotty but the code is rock solid and it's over the years accrued a lot of useful utilities into it. The final decision is yours but for a new project, I'd go with Flask.
0
0
0
0
2011-04-17T18:57:00.000
1
1.2
true
5,695,689
0
0
1
1
For these pythonic web frameworks; They looks similar, except a few minor differences like their url handling schemes. So it is very hard to choose one of them. I want to learn from your experiences that which one more suits for a web application that is small in size, but need long term support (initial application is small but it is supposed to became larger over time) and why?
Django Admin : Grouped data in the list
5,699,159
0
8
3,477
0
python,django,admin
What about using list_filter='my_field' in the admin.py file ?
0
0
0
0
2011-04-18T05:39:00.000
2
0
false
5,698,957
0
0
1
1
Can I show a grouped result in Django Admin? By default, they are showing all rows, I want to group these rows based on some fields, and display it. Something like "GROUP BY username" or stuff. I've tried to search but no luck :(
Analyze logfile from GAE
5,699,117
1
0
220
0
python,google-app-engine
I suggest you use Google Analytics on your web app. If you want to do some sort of server-side visitor analaytics (instead of the client-side Javascript that Google Analytics uses), you'd have to store something in a database (BigTable on GAE) and run your own analytics.
0
1
0
0
2011-04-18T06:02:00.000
2
1.2
true
5,699,092
0
0
1
1
Hi My app had visitors and I like to analyze the log file. Can I run a log analyzer program on the log file that google app engine allows us to download? Are third-party programs such as webalizer and visitors compatible? Thank you
MySQL&django hangs on huge session delete
5,703,375
1
1
513
1
python,mysql,django
I am not MySQL expert, but I guess MySQL locks the table for the deleting and this might be MySQL transaction/backend related. When deleting is in progress MySQL blocks the access to the table from other connections. MyISAM and InnoDB backend behavior might differ. I suggest you study MySQL manual related to this: the problem is not limited to Django domain, but generally how to delete MySQL rows without blocking access to the table. For the future reference I suggest you set-up a session cleaner task which will clear the sessions, let's say once in a day, from cron so that you don't end up with such huge table.
0
0
0
0
2011-04-18T13:03:00.000
4
0.049958
false
5,703,308
0
0
1
2
I'm running django site with MySQL as DB back-end. Finally i've got 3 millions rows in django_session table. Most of them are expired, thus i want to remove them. But if i manually run delete from django_session where expire_date < "2011-04-18" whole site seems to be hanged - it cannot be accessed via browser. Why such kind of blocking is possible? How to avoid it?
MySQL&django hangs on huge session delete
5,703,378
5
1
513
1
python,mysql,django
If your table is MyISAM, DELETE operations lock the table and it is not accessible by the concurrent queries. If there are many records to delete, the table is locked for too long. Split your DELETE statement into several shorter batches.
0
0
0
0
2011-04-18T13:03:00.000
4
1.2
true
5,703,308
0
0
1
2
I'm running django site with MySQL as DB back-end. Finally i've got 3 millions rows in django_session table. Most of them are expired, thus i want to remove them. But if i manually run delete from django_session where expire_date < "2011-04-18" whole site seems to be hanged - it cannot be accessed via browser. Why such kind of blocking is possible? How to avoid it?
PyMongo vs MongoEngine for Django
6,248,071
1
35
27,617
0
python,django,mongodb,pymongo,mongoengine
mongoengine will use the pymongo driver to connect to mongodb. If you are familiar with django.. use mongoengine
0
0
0
0
2011-04-19T07:14:00.000
4
0.049958
false
5,712,857
0
0
1
2
For one of my projects I prefered using Django+Mongo. Why should I use MongoEngine, but not just PyMongo? What are advantages? Querying with PyMongo gives results that are allready objects, aren't they? So what is the purpose of MongoEngine?
PyMongo vs MongoEngine for Django
5,712,928
21
35
27,617
0
python,django,mongodb,pymongo,mongoengine
I assume you have not read the MongoEngine claim. MongoEngine is a Document-Object Mapper (think ORM, but for document databases) for working with MongoDB from Python. This basically say it all. In addition: your claim that Pymongo would deliver objects is wrong....well in Python everything is an object - even a dict is an object...so you are true but not in the sense of having a custom class defined on the application level. PyMongo is the low-level driver wrapping the MongoDB API into Python and delivering JSON in and out. MongoEngine or other layers like MongoKit map your MongoDB-based data to objects similar to native Python database drivers + SQLAlchemy as ORM.
0
0
0
0
2011-04-19T07:14:00.000
4
1.2
true
5,712,857
0
0
1
2
For one of my projects I prefered using Django+Mongo. Why should I use MongoEngine, but not just PyMongo? What are advantages? Querying with PyMongo gives results that are allready objects, aren't they? So what is the purpose of MongoEngine?
Can I extend Jenkins with Jython/Python
5,714,293
0
8
2,437
0
java,python,continuous-integration,jython,jenkins
Since Jython can produce Java classes I see no reason why this should not work. Note that you will need to learn at least some things about Java (mostly the platform, not necessarily the language) in order to be able to write plugins for Jenkins.
0
0
0
0
2011-04-19T09:26:00.000
3
0
false
5,714,263
0
0
1
1
Is it possible to write Jenkins plugins using Python (via Jython), and if so, where would I get started? I don't know Java (and don't have a real interest in learning it at the moment) so being able to use Python would be nice for me.
Accessing key field into Django Template
5,714,546
0
0
125
0
python,google-app-engine,django-templates
There are 2 solutions: You should filter the data before passing it into view You can write additional function in model for retrieving the key if it`s not a field already Can you explain exactly what is **__key__** ?
0
0
0
0
2011-04-19T09:43:00.000
2
0
false
5,714,462
0
0
1
1
How can I access key field of model into django template?
How do I reintroduce South to my Django project?
5,716,010
3
2
538
0
python,django,postgresql,django-south,reinstall
South creates a table in your database to track migrations that have been applied. The table is south_migrationhistory. You probably want to either drop the table (and re-sync your db) or delete it's contents. I imagine at the moment south thinks that it's applied migration that it hasn't, which may be confusing things.
0
0
0
0
2011-04-19T11:01:00.000
1
1.2
true
5,715,320
0
0
1
1
I'm in the classic position of the novice coder, where in hindsight I'd do many things differently if I were starting my project over. I used South relatively early in my project, ran into some problems due to my lack of knowledge, and abandoned it, removing it from installed apps, and syncing the DB. I then learned enough SQL to make the basic changes I needed, and have made many small changes since. I'd like to take another stab at South to see if I could reorganize my code to reflect better coding practices. I've searched the South site, with help from stackoverflow, and found a guide from the creator for removing all traces of South and starting again-- remove from installed apps, use the manage.py tool to reset the south table in the db, and recursively delete the migrations subdirectories. But even though I've not been using south for a long time now (it hasn't been in my installed apps), this left my DB in an nonfunctional state-- not really sure why since I didn't get any error messages. Can anyone explain to a database novice what lingering impact south would have had on my database?
Using JRuby or Python to call some 3rd party Java libraries - architecture question
5,723,661
1
0
215
0
java,python,ruby,jruby,jython
I know for a fact that you can call all your Java libraries using JRuby. You can use the ruby programming language on your front and back end via Rails (Rails is a framework written in ruby). The difference between MRI (Matz Ruby) and JRuby is that JRuby runs on the JVM, whereas MRI has its own VM which is different from the JVM. By running on the JVM, you gain access to a whole lot of Java libraries.
0
0
0
0
2011-04-19T21:08:00.000
2
1.2
true
5,722,739
0
0
1
1
I am evaluating what I will use on the front and back ends of a project. I definitely will need to use some 3rd party Java libraries, but I am curious whether there is a nice way to do the front and back-end layer in something like Ruby or Python? Or is it possible to just call the Java libraries from Ruby/Python and avoid programming using Java alltogether? :) All of these run on Tomcat, and are deployed using a .war file, correct?
Can't access MySQL database in Django VirtualEnv on localhost
8,742,834
1
1
1,450
1
python,mysql,django,mysql-error-1045
I found the problem I was having. Django was importing a different settings.py file. I had another django project inside my django product like myproject/myproject/. Instead of importing myproject/settings.py, it was importing myproject/myproject/settings.py I assume that Aptana Studio created that project there. If you use eclipse you are also likely to have this problem.
0
0
0
0
2011-04-20T06:39:00.000
1
1.2
true
5,726,440
0
0
1
1
I have had a virtualenv for Trunk up and running for a while, but now I am trying to branch, and get things setup on another virtualenv for my 'refactor' branch. Everything looks to be setup correctly, but when I try to run any manage.py commands, I get this error: _mysql_exceptions.OperationalError: (1045, "Access denied for user 'brian'@'localhost' (using password: NO)") I just don't understand why it's not attempting to use the password I have set in my django settings file. Is there some addition mysql setup I could have overlooked? Does this issue ring any bells for anyone? Thanks in advance.
Automate WordPress Install from python
5,732,608
0
3
1,206
0
python,wordpress
Urllib is an option, but because your script is running on the local machine anyway, I would probably use os.system. That way you can execute the php script like from a shell. You have to look into the php file on how to pass the parameters.
0
1
0
1
2011-04-20T14:56:00.000
2
0
false
5,732,384
0
0
1
2
I have a python program that sets up a wordpress site on my server. It downloads the zip and unzips it into a directory, sets up the database and user, configures the config file. Now I would like to call the the wp_install function in wp-admin/include/upgrade.php and pass it the parameters it needs $weblog_title, $user_name, $admin_email ... My question is how can I call this function from python? Can I do a urllib.urlopen and if so how do I call the wp_install function with the right parameters?
Automate WordPress Install from python
5,732,698
1
3
1,206
0
python,wordpress
It looks like wp_install() gets called inside of /wp-admin/install.php during step 1, and after form data has been validated. If you submit ?step=1& ... (all of the other required form fields) it should result in calling wp_install. So yes, you should be able to use urllib(2) for this.
0
1
0
1
2011-04-20T14:56:00.000
2
0.099668
false
5,732,384
0
0
1
2
I have a python program that sets up a wordpress site on my server. It downloads the zip and unzips it into a directory, sets up the database and user, configures the config file. Now I would like to call the the wp_install function in wp-admin/include/upgrade.php and pass it the parameters it needs $weblog_title, $user_name, $admin_email ... My question is how can I call this function from python? Can I do a urllib.urlopen and if so how do I call the wp_install function with the right parameters?
How do I replicate "from module import class" with __import__() or django.utils.importlib?
5,737,203
0
0
250
0
python,django
Or import(module,globals(),locals(),['classname',],-1)
0
0
0
0
2011-04-20T17:22:00.000
3
0
false
5,734,186
1
0
1
2
I want to import a class from python module. The module contains multiple classes and which one I need is determined by a string at runtime. Edit: I'm using python 2.6.5, django 1.3.
How do I replicate "from module import class" with __import__() or django.utils.importlib?
5,734,239
1
0
250
0
python,django
With judicious use of getattr().
0
0
0
0
2011-04-20T17:22:00.000
3
1.2
true
5,734,186
1
0
1
2
I want to import a class from python module. The module contains multiple classes and which one I need is determined by a string at runtime. Edit: I'm using python 2.6.5, django 1.3.
Django REST browser interface
5,750,681
3
3
2,220
0
python,django,web-services,testing,rest
As the author of django-rest-framework it'd be great to pick your brains about which bits of functionality could do with fleshing out. :) (obv i've got some thoughts of my own and areas I'm planning to work on, but be really good to get some user perspective) Your absolutely right about the API browser not being limited to any particular framework. To me that's the big deal with DRF and I'd love to see more API frameworks take a similar approach. One of the supposed benefits of RESTful APIs is that they should be self-describing, and it seems counter-intuitive to me that so many of the Web APIs we build today are not Web browseable. Oh, and totally agree with jsw re. testing Web APIs in django, I wouldn't use the framework's browsable API to replace automated tests.
0
0
0
0
2011-04-20T21:29:00.000
2
0.291313
false
5,736,868
0
0
1
1
I'm writing a set of REST services for a Django project. I've been using django-rest-framework for a while. Because of its limited functionality I had to switch to django-piston which I quite enjoy. However, django-rest-framework had one really nice feature - it was able to display an admin-like interface for testing the created services from the browser. It's just terrific for debugging purposes. It's very simple: one form is displayed for each HTTP method like "GET", "POST", etc. Along with that a drop-down list of available content types and a text field for putting in the data to be sent. As I view it, this isn't really a feature in any way directly connected with a particular REST framework. It isn't even necessarily about Django. It could all be achieved just using HTML + JS, or an external website. My question is: What do you use for manual testing / debugging web services? Could you point me to some HTML snippet or a Django app that would do the described thing?
SVN Integration with django
5,737,523
6
1
478
0
python,django,svn
You can have a post-commit hook in the svn repo that uses, ideally, a restful interface to your Django app and adds the note. That way your app remains very simple.
0
0
0
0
2011-04-20T22:42:00.000
1
1.2
true
5,737,483
0
0
1
1
I have a small bug tracker written in django. I'd like to integrate it with an svn repository so that when someone commits to svn it will automatically add a note to an issue in the bug tracker. Does anyone have any input on how to best approach this? Should I setup svn hooks? use a cron job and pull from the log?
Export test as python from Selenium IDE
15,879,812
6
10
16,458
0
python,firefox,selenium,selenium-ide
What version of SIDE are you running? If you are running the latest version (1.9), go into options, check the box off for "Enable Experimental Features" and the formats menu should now list Python.
0
0
1
0
2011-04-21T20:14:00.000
3
1.2
true
5,749,321
0
0
1
1
I made several tests in Selenium IDE and saved it as a test suite in the HTML format which works fine for importing back into selenium IDE. Now however I would like to expand these tests using python and when I click export test suite and choose python I get this error Suite export not implemented for the chrome://selenium-ide/content/formats/python-rc formatter How can I enable this option in selenium IDE? Note I also have found an additional plugin for Firefox that allows batch conversion of tests but still does not allow export of the entire test suite as one file. I realize I could combine these files by hand but in the future I would like to have this option in my workflow. Thank you. p.s Running Firefox 3.6 on fedora 14
pydev does not recognize django installation
17,463,869
2
5
4,493
0
python,django,pydev
I had the exact same problem - only with later versions of the different softwares: Python 3.3.2 and Django 1.5.1 under Eclipse with PyDev 2.7.5. I solved the problem differently: I simply copied the complete Django 1.5.1 folder into the Python "Resources" folder /System/Library/Frameworks/Python.framework/Versions/3.3/Resources/Django-1.5.1 and applied the interpreter again. This worked right away, letting me create a Django project from within the eclipse. Hope this helps. Frank
0
0
0
0
2011-04-21T21:16:00.000
4
0.099668
false
5,749,871
1
0
1
1
I have python 2.6.1 installed with django 1.3 and PyDev 2.0. I am able to import django and print the version from commandline. However, when I try to create a Django project with pydev or even import django I get an error. When creating the django project, I get "Django not found." error. I have tried removing and adding the pythong interpreter to rescan the site-packages. I see that django is not available in the Libraries section. I have even tried adding the folder manually and applying the setting. Am I missing something? Thanks
Capture google app engine logging output
5,758,949
5
3
1,164
0
python,google-app-engine,logging
The default logger sends logging output to stderr. Use your shell's method of redirecting stderr to a file (in tcsh, (dev_appserver.py > /dev/tty) >& your_logfile.txt, your shell may vary.) You can also use the logging module in python to change the logger to send directly to a file if you detect it's running locally (os.environ['SERVER_SOFTWARE'].startswith('Dev'))
0
1
0
0
2011-04-22T17:07:00.000
2
1.2
true
5,757,945
0
0
1
1
How can one view the Google App Engine logs outside the Admin console? I'm developing, so using dev_appserver.py/the Admin Console and would like to see the logs as the records are emitted. I'd like to monitor the logging output in a console with standard Unix tools e.g. less/grep/etc, but there doesn't seem to be an option to direct the logging from the dev_appserver.py command, and I can't open a new file in GAE (e.g. a FileHandler), so file handlers won't work, and I think using a socket/udp handler would be a bit of overkill (if it's even possible). I'm hopeful there are other options to view the log. Thanks for reading.
manage.py runserver
34,825,606
3
88
220,548
0
python,django
in flask using flask.ext.script, you can do it like this: python manage.py runserver -h 127.0.0.1 -p 8000
0
0
1
0
2011-04-24T05:20:00.000
9
0.066568
false
5,768,797
0
0
1
3
I am running python manage.py runserver from a machine A when I am trying to check in machine B. The url I typed is http://A:8000/ . I am getting an error like The system returned: (111) Connection refused
manage.py runserver
34,215,336
4
88
220,548
0
python,django
Just in case any Windows users are having trouble, I thought I'd add my own experience. When running python manage.py runserver 0.0.0.0:8000, I could view urls using localhost:8000, but not my ip address 192.168.1.3:8000. I ended up disabling ipv6 on my wireless adapter, and running ipconfig /renew. After this everything worked as expected.
0
0
1
0
2011-04-24T05:20:00.000
9
0.088656
false
5,768,797
0
0
1
3
I am running python manage.py runserver from a machine A when I am trying to check in machine B. The url I typed is http://A:8000/ . I am getting an error like The system returned: (111) Connection refused
manage.py runserver
32,757,797
0
88
220,548
0
python,django
I had the same problem and here was my way to solve it: First, You must know your IP address. On my Windows PC, in the cmd windows i run ipconfig and select my IP V4 address. In my case 192.168.0.13 Second as mention above: runserver 192.168.0.13:8000 It worked for me. The error i did to get the message was the use of the gateway address not my PC address.
0
0
1
0
2011-04-24T05:20:00.000
9
0
false
5,768,797
0
0
1
3
I am running python manage.py runserver from a machine A when I am trying to check in machine B. The url I typed is http://A:8000/ . I am getting an error like The system returned: (111) Connection refused
How to use Django-filer(asset file manager)?
13,129,716
0
3
1,363
0
python,django,django-filer
Had a similar problem. I had missed that when easy_thumbnails is automatically pulled in by pip, you still have to explicitly add it to your INSTALLED_APPS in settings.py. I spotted this because when I was uploading images, they weren't appearing in the clipboard, and when inspecting the response from the upload, there was an internal server error complaining that an easy_thumbnails table wasn't available. tl;dr; check you added easy_thumbnails to your settings and did a migration / syncdb
0
0
0
0
2011-04-25T16:17:00.000
2
0
false
5,780,397
0
0
1
1
Can someone point me in the right direction on how to use Django-filer? I have installed the necessary tools for the filer to work and I get the Filer tab in the admin interface, but when I upload an image to the app I am not able to get the preview thumbimage. The image is also uploaded to the Media_root path(Public files default path). What else have I missed?
Is it possible to install py26-mysql without installing mysql5 package?
5,782,960
2
0
182
1
python,mysql,macports
To use py26-mysql you don't need the entire server distribution for MySQL. You do need the client libs, at the very least. If you remove the server, you need to make sure you re-install the base libraries needed by the Python module to function.
0
0
0
0
2011-04-25T20:26:00.000
1
1.2
true
5,782,875
0
0
1
1
I am developing a database based django application and I have installed apache, python and django using macport on a snow leopard machine. I ran into issues installing MySQL with macport. But I was able to successfully install a standalone MySQL server (from MySQL.com). Is it possible to remove the MysQL package installed along with py26-MySQL?
Creating a 3 column HTML table with dynamic data in Django
5,785,403
0
7
11,330
0
python,html,django,xhtml
you can use {% if friends|length == 9 %} to check if you have 9 records.
0
0
0
0
2011-04-26T02:41:00.000
3
0
false
5,785,348
0
0
1
1
I am trying to create a dynamic HTML table with 3 columns and 3 rows. Each column will have 3 records from the database so there will be 9 total records displayed (if they have 9 friends. otherwise just however many they have). I am doing this to mainly display small user profile pictures with their friends' usernames on the users homepage. Its going to be a list of 9 of their friends. I am using Django and cannot seem to find a tutorial showing how to display only 3 records per row if I retrieve 9 total records. Any help would be appreciated whether it be a link to a tutorial or info on how to solve this issue. Thanks!
Mechanize and Javascript
5,992,203
6
28
29,397
0
javascript,python,browser,mechanize
Basically if you want something that deals with javascript then you need a real javascript engine, these invariably involve automating a real browser (I'm including headless ones in this). Java’s HtmlUnit doesn't do a very good job as it doesn't use a javascript engine from an actual browser. Phantom JS sounds ideal (as newz2000 points out) however I find that when manipulating pages with javascript it can be very difficult to debug your script if you can't actually see the page you're dealing with. This leads to solutions such as Selenium Webdriver which has a full python API to automate various browsers, however you must run a java jar and it actually launches the browser, so not the pure python solution you're after (but I think this is as close as you can get).
0
0
0
0
2011-04-26T16:32:00.000
5
1
false
5,793,414
0
0
1
1
I want to use Mechanize to simulate browsing to a web page with active JavaScript, including DOM Events and AJAX, and so far I've found no way to do that. I looked at some Python client browsers that support JavaScript like Spynner and Zope, and none of them really work for me. Spynner crashes PyQt all the time, and Zope doesn't support JavaScript as it seems. Is there a way to simulate browsing with Python only (no extra processes) like WATIR or libraries that manipulate Firefox or Internet Explorer while supporting Javascript fully as if actually browsing the page?
How does node.js handle authentication/user systems?
5,794,426
1
3
1,869
0
javascript,python,authentication,node.js
I reviewed the documentation and found no user management system. node.js is a JavaScript server where-as django is an MVC with built-in socket utilities.
0
0
0
0
2011-04-26T17:38:00.000
4
0.049958
false
5,794,238
0
0
1
1
I come from Django's framework, and it has built in "user" system. It takes care of all the registrations, passwords, logins, etc. Does Node.js have this?
web2py: Restrict user to only rows created by the user
5,795,972
1
3
1,415
0
python,web2py
This shouldn't be handled by web2py. Your database is supposed to handle user permissions for this, so you will need to look in the documentation for the db backend you are using. Also, if everyone has a separate user account on your front end that all connect to a single database user, then you won't be able to control the permissions at all without a bunch of independent "security" code added on top of and around your database. For instance, a table in the database that looks at a field supplied by web2py when it connects to determine the "user" and then set the hand coded privileges accordingly. Databases have users for this very reason.
0
0
0
0
2011-04-26T19:54:00.000
5
1.2
true
5,795,708
0
0
1
2
I would like to restrict users to database entries only they have created. Is their any standard web2py way of doing this? auth.requires_permission looked good, but it appears to require a hard-coded row id, which doesn't solve my problem.
web2py: Restrict user to only rows created by the user
7,569,764
0
3
1,415
0
python,web2py
Add a 'created_by' field in the db. Insert the user id when inserting the record. Use this to filter while selecting.
0
0
0
0
2011-04-26T19:54:00.000
5
0
false
5,795,708
0
0
1
2
I would like to restrict users to database entries only they have created. Is their any standard web2py way of doing this? auth.requires_permission looked good, but it appears to require a hard-coded row id, which doesn't solve my problem.
modeling user settings in django
5,797,047
0
9
6,716
0
python,django,settings
Either put them in the user profile model, or create another model with a one-to-one to User.
0
0
0
0
2011-04-26T22:06:00.000
2
0
false
5,797,038
0
0
1
1
I would like have additional settings tied to each user in my application (beyond, is_staff, is_admin etc etc). Basically I'd like to have different settings to customize their user experience (ie: don't show tooltips, how many rows to display in results tables, other flags for turning things on or off). Are there best practices for adding these types of settings, or example model to do this without touching the django user object (in the past when i needed a quick user property, i just added it to my django source code, but obviously know that this is a horrible idea). So when someone sucessfully logs in, I would grab the settings for the user and add them to the session. I wasn't sure if there was a pretty way, or best practice for doing this.
Django/Apache/mod_wsgi not using virtualenv's Python binary
5,800,722
2
6
6,113
0
python,django,apache,mod-wsgi,wsgi
I had the same situation in a Pylons app and ended up using /usr/bin binary plus virtualenv site-packages dir instead. Of course it was the same python version...
0
0
0
0
2011-04-27T07:07:00.000
4
0.099668
false
5,800,608
1
0
1
1
I have a virtualenv at /opt/webapps/ff/ with its own Python installation. I have WSGIPythonHome set to /opt/webapps/ff in my Apache config file (and this is definitely getting used in some capacity, because if I set it to a slightly different existing directory and restart Apache I get a 504). But if I e.g. assert False in a view somewhere to bring up the Django debug page, I see that settings.PYTHON_BIN is /usr/bin rather than /opt/webapps/ff/bin. How do I get Apache/mod_wsgi to use my virtual environment's Python binary? I thought setting WSGIPythonHome was the way to do this, but it only seems to affect which site-packages dir is used, not which binary is used. Thanks.
How to send the text pasted in a textbox of a html webpage to the application written in python in the harddisk?
5,808,829
1
0
77
0
python,html,web-hosting
Here's my suggestion: modify your program to include a button for doing the transformation. When you click it, it should take the contents of the clipboard, do whatever transformation you want, and put the result back on the clipboard. Once you do that, to use it you select the text from the widget, use the keyboard to copy it to the clipboard, press the button on the GUI, then click back in the widget and use the keyboard to paste. Alternately, your program can just poll the clipboard every couple of seconds, do the transformation and put the results back (make sure your automatic polling ignores any changes caused by itself). With that you can do a select-all, copy, wait a couple seconds, then paste. This is pretty trivial to do in both Tkinter and wxPython, and I would guess it is equally trivial with most other GUI toolkits.
0
0
0
0
2011-04-27T16:55:00.000
2
1.2
true
5,807,715
0
0
1
2
I have a application running in python, i want to send the input taken from the text box of the webpage and send it as input to the application and once again the output of the application which is in text format back to the result page on web. thanks a lot for your time :) :)
How to send the text pasted in a textbox of a html webpage to the application written in python in the harddisk?
5,808,739
0
0
77
0
python,html,web-hosting
Have you tried PyQt4 which has this ability built-in? You can do what you're asking in about ten LOC.
0
0
0
0
2011-04-27T16:55:00.000
2
0
false
5,807,715
0
0
1
2
I have a application running in python, i want to send the input taken from the text box of the webpage and send it as input to the application and once again the output of the application which is in text format back to the result page on web. thanks a lot for your time :) :)
Real time chart (SVG) + AJAX/Javascript/Jquery + StdOut + Python + I dont really know myself
5,809,518
0
1
5,305
0
python,ajax,svg,cgi,charts
I would use JavaScript to create or manipulate an SVG document, with AJAX requests polling the server and getting data back.
0
0
1
0
2011-04-27T18:33:00.000
4
0
false
5,808,819
0
0
1
1
I am not sure how to accurately describe my problem , and right now i have a total mess in my head , so please deal with it and correct me if i am wrong , and i will be for sure. MAIN GOAL: Is to built a real time line chart , which updates itself without web page reloading based on data , which comes from stdout . So it basically must be python script , which gets every second value , and based on this values continues to draw line in a line chart . 1) Well basic tags in my head right now are : Javascript / AJAX , cgi , python http web server , SVG (Vector graphics). So basically the biggest problem , which i dont understand is how to continuesly transfer stdout values to the webpage . Should i write my own python http web server , somehow pass values and with javascript or ajax + SVG draw the chart . Or writing a http web server is a stupid idea and i can somehow make it work without it ? Any other suggestions , or pointing me to some tutorials or arcticles are welcome . Because right now i am very confused , especially on the part of continuesly passing values to webpage. Thx in advance. Hope you will be able to point me somewhere =)
Python raising _ExpectedFailure for unittests with @unittest.expectedFailure
5,810,407
1
4
665
0
python,unit-testing
I have the problem and I got it to work by deleting the /usr/local/lib/python2.7 and then reinstalling everything from scratch. The reason for this I believe is that python may not have cleared it's python object and cache files(*.pyc, *.pyo) from it's working directory. That is, not YOUR project's directory but where python actually runs from. Not sure if that's it but it worked for me!!
0
0
0
1
2011-04-27T19:16:00.000
1
1.2
true
5,809,333
0
0
1
1
I have two systems running the same set of Django unittests. Some of the tests use the @unittest.expectedFailure decorator. On one system, these are running fine and reporting at the end of the test run OK (expected failures=10, unexpected successes=2). On the other system, the same tests error, but raise _ExpectedFailure and _UnexpectedSuccess without tracebacks. Has anyone seen this behavior before? Is it a configuration issue? Both systems are running Python 2.7, Django 1.3, and have unittest and unittest2 installed.
Django for social networking
39,394,293
0
30
24,265
0
python,django
This is not an issue only on Django or python, it's a thing of cloud and software engineering. One server alone may be ok for 10,000 users, given they are not concurrent, also location, are these users in the same city? country? I believe Django is very good and I will use it my self in a similar project, my issue is not Django but the IaaS, the infrastructure where I will run this on. If you are still worried if Python is the answer then you can research about, Ruby on Rails, and asp .Net, even perl, php, stuff like that. To me, Python is definitely the answer.
0
0
0
0
2011-04-27T21:02:00.000
7
0
false
5,810,540
0
0
1
1
I know this is a relatively broad question, but is Django robust enough to build a social network on? I am concerned mainly with performance/speed. For example, for a site with a small user base (<10,000 users), is it possible to create a Django-backed site that would perform at a speed similar to Facebook? What are its potential weaknesses, and things that need to be focused on in order to make it as fast as possible?
How do I access user information with django with django-social-auth?
5,815,430
1
0
348
0
python,django,oauth
If I remember correctly they just use the default user model. So just like with the default user object you can create a profile model to store additional information.
0
0
0
0
2011-04-28T05:31:00.000
1
1.2
true
5,814,042
0
0
1
1
My guess is that I am still able to use the user object to get the default information like email or user name. Is this correct? What if I would like to access some more information not specified on django default user object?
How to view crawled unicoded arabic string?
5,821,867
0
1
1,490
0
python,unicode,web-crawler
As others suggested it is not a bad idea to view the file in a browser. Store it in utf-8 (like open('x.html','w').write(x.encode('utf-8'))), as most browsers are well equipped to handle utf-8. In the browser, you may need to change View->Character Encoding to Utf-8. You will need Arabic fonts on your machine, so the browser can use these to display the characters. Having written this, any file viewer/editor that is capable of decoding utf-8 and has access to the fonts can do this for you (e.g. vim works fine on my machine).
0
0
0
0
2011-04-28T06:06:00.000
5
0
false
5,814,324
0
0
1
1
I have crawled some webpages using Python. I ripped off the html tags and only stored some content of those pages as repr(s). Most of those pages are not in English. Now how can I view the crawled content in its original language? For example, the crawler wrote only one line of some Arabic text to a txt file: u'\u0639\u0644\u0649' But when I open the txt file in text editer or browser it looks exactly as above, so it's basically not human readable.. Is there some easy way to render and display the string in Arabic? Thanks,
Python: Need to extract tag content from html page using regex, but not BeautifulSoup
5,814,571
0
0
2,535
0
python,html,regex,tags,substring
Using non greedy matching (*?) can do this easily, at least for your example. re.findall(r'<raw[^>]*?>(.*?)</raw>', DATA)
0
0
1
0
2011-04-28T06:25:00.000
2
0
false
5,814,493
0
0
1
1
I have a requirement wherein I have to extract content inside <raw> tag. For example I need to extract abcd and efgh from this html snippet: <html><body><raw somestuff>abcd</raw><raw somesuff>efgh</raw></body></html> I used this code in my python re.match(r'.*raw.*(.*)/raw.*', DATA) But this is not returning any substring. I'm not good at regex. So a correction to this or a new solution would help me a great deal. I am not supposed to use external libs (due to some restriction in my company).
What is the best API for registering and configuring domain names?
5,814,951
2
6
4,713
0
python,api,hosting,dns,registration
There is no general API for this. You have to check back with your own domain registration organization. This is specific to the related domain provider.
0
0
1
0
2011-04-28T06:59:00.000
3
0.132549
false
5,814,837
0
0
1
1
I'm trying to make a website that allows you to setup a photo gallery with a custom domain name. Users of the site don't know how to register or configure domain names, so this has to be done for them. User enters desired domain name in a box (we check if it's available) and click 'register' button and our website registers the domain name for them and sets up the website automatically (when user goes to that domain name, the photo gallery just works, no technical skills needed).
Is it possible to reconcile github and docutils buildhtml?
5,863,357
1
0
204
0
python,github,restructuredtext,docutils
Perhaps you can just use a symlink?
0
0
0
0
2011-04-28T12:00:00.000
2
1.2
true
5,818,242
1
0
1
1
Github will parse a reStructuredText file if its extension is .rst. The docutils buildhtml.py will only parse files with the extension .txt, and I can't see an option to change that. This is massively annoying. Is there any way to get Github to recognise .txt files as RST or buildhtml to recognise .rst files?
In Django Admin, how do you have cascaded InlineModelAdmin
5,821,241
0
0
412
0
python,django
If you just want to append some links like in the Restaurant change view, you don't really need to use an inline as this provides a form for changing data. I would probably override change_view in RestaurantAdmin to get a list of the related menus and pass it as an extra_context. And then override the model specific change_form.html template to render the menu links.
0
0
0
0
2011-04-28T13:14:00.000
2
0
false
5,819,205
0
0
1
1
Hi I have a list of restaurants (e.g. McDonalds, etc), with menus (e.g Lunch Menu, Dinner Menu), submenus (e.g. Appetizers, Sandwidches, etc.) and dishes (Angus Burger, Chicken Burger, etc.) They are all linked by foreign keys. Is there a way, so that in the Restaurant admin, I have Menu as a tabular inline, with a link to go edit that menu (in it's own admin page, not inline) so that there I can display the submenus inline with the menu admin. Each submenu has a link to edit that submenu item (in it's own admin page, not inline) so that there I can display the dishes inline. THanks.
How can a flex mxml file being run on server as swf/html file be made non cachable?
5,825,199
0
0
325
0
python,html,apache-flex
The random querystring idea is a good way to make sure the swf is downloaded everytime, but that might not be what you really want to do. Especially if your swf is large in size and it only occasionally needs to update. What I would do is have a service that outputs the most recent version number of my swf. You'll have to come up with a version scheme that works for you (could be an svn build number for instance). When the swf build number changes, the new swf gets downloaded to the web browser. This would be accomplished by having your old swf make a service call early in the load process, if it finds a swf build number newer than its own, it would make a javascript call to the web browser causing the swf to be reloaded, appending a new value onto the source url (using the random querystring technique). The javascript call would be made using ExternalInterface.call (in Actionscript). With this approach you can have your swf be cached until a newer swf is available for download, which will save your users bandwidth and load/bandwidth of your server.
0
0
0
0
2011-04-28T15:19:00.000
2
0
false
5,820,970
0
0
1
1
I have a application developed in flex deployed on server. In the application data is filled by user and saved in cookies so as to be available even when the user closes the application. However if new version of application is released the user can still access the older version saved in the cahe. How can it be assured that whenever a new version of application is released the application is loaded from the server and not from the cache and at the same time data saved in the older version (in cookies) can also be accessed in the new version. Any pointers of accomplishing it using html, flex or python will high helpful. Thanks
Serialize an entity key to a string in Python for GAE
5,826,255
3
5
1,650
0
python,google-app-engine
str(entity.key()) will return a base64-encoded representation of the key. entity.key().name() or entity.key().id() will return just the name or ID, omitting the kind and the ancestry.
0
0
0
0
2011-04-28T20:47:00.000
4
0.148885
false
5,824,801
1
0
1
1
In the Java low-level API, there is a way to turn an entity key into a string so you can pass it around to a client via JSON if you want. Is there a way to do this for python?
Integrating python webapp with some jar files
5,835,814
0
0
124
0
java,python
You could always run the jar files in a subprocess and use PIPE for IO (or temp files). This works pretty well for us (we are generating PDF from our Django app with flying saucer and iText)
0
0
0
0
2011-04-29T10:09:00.000
2
0
false
5,830,706
0
0
1
1
Hi I have few jar files which are few calculations compiled into jar files. I have a python web app which is supposed to interact with these jar files and get me the data. I have heard that it can be done using the java bridge. Can someone let me know how this could be done or at least point me to the right link.
Is there any wysiwyg app which I can use to make the frontend pages of a sinmple django webapp?
5,830,888
1
0
198
0
python,django
I found all wysiwyg editors I've used are much more confusing to use than just some plain old html. It is super easy to get started. Do it in plain html.
0
0
0
0
2011-04-29T10:16:00.000
3
0.066568
false
5,830,767
0
0
1
1
I've never done any web development before. I'm using django because I'm OK at python. I just want to make a small webapp which does a small task fast...
Limiting one Content item per Member in a Folder on Plone 4
5,843,705
2
7
301
0
python,permissions,plone,zope,archetypes
Well, it is a sort of validation constraint, so maybe add a validator to the title field that in reality does not bother about the title, but checks the user etc.? (I think a field validator is passed enough information to pull this off, if not, overriding the post_validate method or listening to the corresponding event should work.) If you try this, bear in mind that post_validate is already called while the user is editing (ie on moving focus out of a field).
0
0
0
0
2011-04-29T13:47:00.000
3
0.132549
false
5,832,899
0
0
1
1
I have created a custom Archetypes content type called "Résumé" and would like to enforce a limitation that lets a Member add only one item of this type inside a folder. Even better would be redirecting the member to the edit page of his or her item, if it already exists in that folder. How can I enforce this limitation and provide this extra functionality?
Django - South - Is There a way to view the SQL it runs?
5,897,509
50
28
10,745
1
python,database,migration,django-south
You can at least inspect the sql generated by doing manage.py migrate --db-dry-run --verbosity=2. This will not do anything to the database and will show all the sql. I would still make a backup though, better safe than sorry.
0
0
0
0
2011-04-29T14:32:00.000
5
1
false
5,833,418
0
0
1
2
Here's what I want to do. Develop a Django project on a development server with a development database. Run the south migrations as necessary when I change the model. Save the SQL from each migration, and apply those to the production server when I'm ready to deploy. Is such a thing possible with South? (I'd also be curious what others do to get your development database changes on production when working with Django)
Django - South - Is There a way to view the SQL it runs?
5,932,967
2
28
10,745
1
python,database,migration,django-south
I'd either do what Lutger suggested (and maybe write a log parser to strip out just the SQL), or I'd run my migration against a test database with logging enabled on the test DB. Of course, if you can run it against the test database, you're just a few steps away from validating the migration. If it passes, run it again against production.
0
0
0
0
2011-04-29T14:32:00.000
5
0.07983
false
5,833,418
0
0
1
2
Here's what I want to do. Develop a Django project on a development server with a development database. Run the south migrations as necessary when I change the model. Save the SQL from each migration, and apply those to the production server when I'm ready to deploy. Is such a thing possible with South? (I'd also be curious what others do to get your development database changes on production when working with Django)
Python scripts in HTML
5,842,534
2
9
49,400
0
python,html
You are mixing up client-side and server-side execution of code. Browsers support only Javascript. Any application-server or Python-based webframework support template language where you can mix HTML and Python in some way or the other.
0
0
0
1
2011-04-30T14:47:00.000
5
0.07983
false
5,842,487
0
0
1
1
Is it possible to write Python scripts in HTML code similarly as you write PHP between <?php ... ?> tags? I'd like to achieve that my Python application will run in the browser. thank you for help
Parsing lines from a live streaming website in Python
5,844,901
1
1
858
0
python,stream,live,urllib
You'll have to periodically re-download the website. Don't do it constantly because that will be too hard on the server. This is because HTTP, by nature, is not a streaming protocol. Once you connect to the server, it expects you to throw an HTTP request at it, then it will throw an HTTP response back at you containing the page. If your initial request is keep-alive (default as of HTTP/1.1,) you can throw the same request again and get the page up to date. What I'd recommend? Depending on your needs, get the page every n seconds, get the data you need. If the site provides an API, you can possibly capitalize on that. Also, if it's your own site, you might be able to implement comet-style Ajax over HTTP and get a true stream. Also note if it's someone else's page, it's possible the site uses Ajax via Javascript to make it up to date; this means there's other requests causing the update and you may need to dissect the website to figure out what requests you need to make to get the data.
0
0
1
0
2011-04-30T21:56:00.000
3
0.066568
false
5,844,870
0
0
1
3
I'm trying to read in info that is constantly changing from a website. For example, say I wanted to read in the artist name that is playing on an online radio site. I can grab the current artist's name but when the song changes, the HTML updates itself and I've already opened the file via: f = urllib.urlopen("SITE") So I can't see the updated artist name for the new song. Can I keep closing and opening the URL in a while(1) loop to get the updated HTML code or is there a better way to do this? Thanks!
Parsing lines from a live streaming website in Python
5,844,908
0
1
858
0
python,stream,live,urllib
Yes, this is correct approach. To get changes in web, you have to send new query each time. Live AJAX sites do exactly same internally. Some sites provide additional API, including long polling. Look for documentation on the site or ask their developers whether there is some.
0
0
1
0
2011-04-30T21:56:00.000
3
0
false
5,844,870
0
0
1
3
I'm trying to read in info that is constantly changing from a website. For example, say I wanted to read in the artist name that is playing on an online radio site. I can grab the current artist's name but when the song changes, the HTML updates itself and I've already opened the file via: f = urllib.urlopen("SITE") So I can't see the updated artist name for the new song. Can I keep closing and opening the URL in a while(1) loop to get the updated HTML code or is there a better way to do this? Thanks!
Parsing lines from a live streaming website in Python
5,844,912
1
1
858
0
python,stream,live,urllib
If you use urllib2 you can read the headers when you make the request. If the server sends back a "304 Not Modified" in the headers then the content hasn't changed.
0
0
1
0
2011-04-30T21:56:00.000
3
0.066568
false
5,844,870
0
0
1
3
I'm trying to read in info that is constantly changing from a website. For example, say I wanted to read in the artist name that is playing on an online radio site. I can grab the current artist's name but when the song changes, the HTML updates itself and I've already opened the file via: f = urllib.urlopen("SITE") So I can't see the updated artist name for the new song. Can I keep closing and opening the URL in a while(1) loop to get the updated HTML code or is there a better way to do this? Thanks!
get_serving_url question
5,848,560
2
0
188
0
python,google-app-engine
No. size=120 is something you could pass as the 2nd argument to the get_serving_url method. =s120 would be something that you append to the URL returned by get_serving_url. The effect is the same: larger images are scaled down, but smaller images are not scaled up.
0
0
0
0
2011-05-01T09:50:00.000
1
1.2
true
5,847,679
0
0
1
1
Hi My question is whether I've understood the usage correctly: Adding =s120 to the url will scale the image to 120 pixels and adding the parameter size=120 will behave differently: It will only shrink images larger than 120 pixels. Is this true? Thank you
If I open and read the file which is periodically written, can I/O deadlock occur?
12,211,059
0
1
773
1
python,linux,performance,io,deadlock
Quick advice, make sure (like, super sure) that you do close your file. So ALWAYS use a try-except-final block for this Remember that the contens of a final block will ALWAYS be executed, that will prevent you a lot of head pain :)
0
1
0
0
2011-05-01T11:55:00.000
2
0
false
5,848,184
0
0
1
1
In my server process, it looks like this: Main backend processes: Processes Huge list of files and , record them inside MySQL. On every 500 files done, it writes "Progress Report" to a separate file /var/run/progress.log like this "200/5000 files done" It is multi-processed with 4 children, each made sure to run on a separate file. Web server process: Read the output of /var/run/progress.log every 10 seconds via Ajax and report to progress bar. When processing a very large list of files (e.g. over 3 GB archive), the processes lock up after about 2 hours of processing. I can't find what is going on. Does that mean that /var/run/progress.log caused an I/O deadlock?
how to map url with usernames prefixed?
5,848,509
0
2
164
0
python,url,flask
By pointing all the subdomains of that domain to the same website via DNS, and then inspecting the HTTP 1.1 Host header to determine which user website is being viewed.
0
0
1
0
2011-05-01T12:59:00.000
2
0
false
5,848,496
0
0
1
1
Suppose there is a web app name thesite.com. I need to give every user a url of his own. For eg- if alice signs up, she gets a space of her own at the url "alice.thesite.com".. How do I achieve this. Thanks Alice
Using Django minus the web server
5,858,438
0
14
4,303
0
python,django,model-view-controller,qt,hybrid
You'll still have to run the Django app as a web server, but you can restrict it to serve to only localhost or something. And sure, you can use QtWebKit as the client.
0
0
0
0
2011-05-02T14:29:00.000
2
0
false
5,858,392
0
0
1
1
I'm writing a syndication client, with the aim being to have a client for devices, and a web site that has the same functionality. I shall develop the website using Django - this is already decided; the client shall be written in python with both a CLI and a PyQt4 GUI. I have been writing the clinet first, and it's fairly database-heavy, as everything is cached to enable it to be read while offline. It struck me today that it would make sense to use Django models for my application, to reduce the repetition of effort between the client and the website. My question is how easy it is to seperate this, and how much of Django I will need in my client to use Django's models. AFAIK I should not need to run the server, but what else is needed? I had an idea of generating the same html for my client as the website, but showing it withing Qt widgets rather than serving pages for a browser. Has anyone tried this sort of thing before? I'm starting on this already, but it would be good to get a warning of potential dead-ends or things that will create a maintainance nightmare...
How can I send a user registration confirmation email using Tornado and MongoDB?
7,483,440
6
5
3,734
1
python,email,tornado
I wonder why you would handle registration like that. The usual way to handle registration is: Write the user info to the database, but with an 'inactive' label attached to the user. Send an email to the user. If the user confirms the registration, then switch the user to 'active'. If you don't want to write to the database, you can write to a cache (like memcache, redis), then when the user confirms the registration, you can get the user info from the cache and write it to the database.
0
1
0
0
2011-05-02T20:41:00.000
2
1
false
5,862,238
0
0
1
1
I'm working with Tornado and MongoDB and I would like to send a confirmation email to the user when he creates an account in my application. For the moment, I use a simple XHTML page with a form and I send information to my MongoDB database using Tornado. I would like to have an intermediate step which sends an email to the user before inserting the data into the database. I would like to know how could I send this email and insert the user account only after the user receives the email and confirms his registration.
Deploying an app to users' appspot
5,872,643
0
0
193
0
python,google-app-engine
No. Writing an application that deploys other applications is in violation of the terms of service. Note we don't have any 'hard' limits - those limits that aren't billing enabled can be increased on application to us if you provide a reasonable use-case.
0
1
0
0
2011-05-03T05:19:00.000
5
0
false
5,865,349
0
0
1
3
I am working on a Python App, which runs on App Engine. Is there a way I can publish the app on each customers' appSpot account, so that the App uses the users' cloud storage? Instead of running the App on my AppSpot account and all the users storing the data on my Cloud space?
Deploying an app to users' appspot
5,870,645
1
0
193
0
python,google-app-engine
Yes, absolutely. You just need to have each client create an App Engine account with an application to which you have administrator access. You can adjust the settings on the application to forbid downloads of your code by the other administrators if that's appropriate for your agreement with the client. This also allows the clients to be billed directly for their instances' usage, and makes it completely impossible for data to leak between different clients' instances. Using multiple applications for multiple clients who are licensing your application almost certainly does not violate part 4.4 of the TOS, although don't take this as legal advice.
0
1
0
0
2011-05-03T05:19:00.000
5
1.2
true
5,865,349
0
0
1
3
I am working on a Python App, which runs on App Engine. Is there a way I can publish the app on each customers' appSpot account, so that the App uses the users' cloud storage? Instead of running the App on my AppSpot account and all the users storing the data on my Cloud space?
Deploying an app to users' appspot
5,865,451
1
0
193
0
python,google-app-engine
No, you cannot do that. The app is hosted and run in the administrator's account which would be you. What you can do is, release the source code and point your users do install it in their appspot account, just like creating a new application.
0
1
0
0
2011-05-03T05:19:00.000
5
0.039979
false
5,865,349
0
0
1
3
I am working on a Python App, which runs on App Engine. Is there a way I can publish the app on each customers' appSpot account, so that the App uses the users' cloud storage? Instead of running the App on my AppSpot account and all the users storing the data on my Cloud space?
sqlalchemy identity map question
5,869,588
0
6
2,298
1
python,sqlalchemy,identity-map
So this all depends on how you setup your sqlalchemy connection. Normally what you do is to manage each wsgi request to have it's own threadlocal session. This session will know about all of the goings-on of it, items added/changed/etc. However, each thread is not aware of the others. In this way the loading/preconfiguring of the models and mappings is shared during startup time, however each request can operate independent of the others.
0
0
0
0
2011-05-03T12:35:00.000
2
0
false
5,869,514
0
0
1
1
The identity map and unit of work patterns are part of the reasons sqlalchemy is much more attractive than django.db. However, I am not sure how the identity map would work, or if it works when an application is configured as wsgi and the orm is accessed directly through api calls, instead of a shared service. I would imagine that apache would create a new thread with its own python instance for each request. Each instance would therefore have their own instance of the sqlalchemy classes and not be able to make use of the identity map. Is this correct?
Class-based (generic) views in Flask
5,870,277
11
5
2,127
0
python,web-frameworks,flask,django-class-based-views
Starting with Python 2.6 you can apply the decorators to classes as well. There is no builtin pattern for callable classes because there are too many ways to implement them, but essentially the trick would be to override __call__ on the class and to have a wrapper decorator that instanciates the class. I was planning on having a class-based-view extension but so far nobody came up with some good behavior for it :)
0
0
0
0
2011-05-03T13:07:00.000
1
1.2
true
5,869,899
0
0
1
1
What's the best way to write generic views using the Flask web framework? Does the @app.route decorator support callable classes? Or am I thinking about this in entirely the wrong fashion? Any help or advice would be greatly appreciated!
Google app engine gql query two properties with same string
10,265,451
0
3
631
1
python,google-app-engine
Note that there is no gain of performance in using Drew's schema, because queries in list properties must check for equality against all the elements of the list.
0
0
0
0
2011-05-03T21:24:00.000
3
0
false
5,875,881
0
0
1
1
I have a data model called Game. In the Game model, I have two properties called player1 and player2 which are their names. I want to find a player in gamebut I don't know how to buil the query because gql does not support OR clause and then I can't use select * from Game where player1 = 'tom' or player2 = 'tom' statement. So, how can I solve this question? Do I have to modify my data model?
Django non blocking email? Downsides to threading.thread or subprocess?
5,877,718
9
5
1,266
0
python,django,multithreading
Offloading the work to some other external process is really the right thing to do, and once you've done it, it's not likely to be the last time you do it. Celery/RabbitMQ is a decent solution, and the nice thing is they're already there. Recent RabbitMQ releases have a decent web-based management app and a decent management API that'll make babysitting pretty easy, and celery works pretty well in Django apps. You can do this with subprocess or threading, but to be honest, I think that's a bad habit to get into. Unfortunately, they're the most straightforward ways to do what you want to do if you don't want to offload things. If you wanted to go completely 'ghetto async email' you could have your app just dump emails to files in a directory and have a cron job check the directory for files in that directory every minute, and send them off as emails, but really that's a lot more work than rabbit/celery. I say just go with rabbit/celery. It's not as much work as it seems, and it's worth it going forward.
0
1
0
0
2011-05-04T01:56:00.000
2
1.2
true
5,877,658
0
0
1
1
I have a django site. Certain actions by the end user send email to the rest of users in a group. When the number of users gets to be > 20 it can add 1-3 seconds to the request cycle, which I don't like. I'd like to be able to send the email from a non-blocking function. I know RabbitMQ and Celery in conjunction can solve this, but with 200 users that seems like over-engineering and it adds two more applications I have to install, understand, and babysit. I've done some research, and it appears that both threading.Thread and subprocess would be ways to wrap a non-blocking call. Am I missing an obvious way to do this? Are there downsides to using either the threading.thread or subprocess approach? Thanks, Ted
Multi tier architecture implementation on Python
5,880,853
4
0
3,223
0
python
This architecture really makes no sense. You're using Django, a full-stack web framework, for the front end, but not using it for the database. And you're using Pyramid, another full-stack web framework, for the web service side, thus ensuring that you duplicate all the business logic. Much as I am an advocate of Django, I would say it has no place in your architecture. It looks like the only thing you're really using it for is URL routing and templates, both of which Pyramid does itself fine - you can even use Jinja2, which is based on Django's template language, as the template language in Pyramid if you like. Doing it this way means that you can share the business logic between the front-end and web service code, since you'll almost certainly find that a lot of it will be the same. I must say also that I don't understand the division into tiers, which you have described as separate from the front-end/web service division. To me, the web service is the second tier. It makes no sense to have a further division.
0
0
0
0
2011-05-04T08:10:00.000
2
0.379949
false
5,880,438
0
0
1
2
I need to create web application, which can be reached by user as regular web site and as XML-RPC web service. Also web site should have mobile version. I'm planning to use next technologies: Django (for web frontends (regular and mobile)). Pyramid (for web service). SQLAlchemy, Memcached (for persistence level) Later other projects can reach this data and providing logic, so I think it is better to make two tiers. I see it in next way: Tier 1. Main logic service level. This level will provide API for frontend applications (Django powered web site, for example). Tier 2. Different mostly end client applications (web site, API for remote client devices). For communication between this tiers I'm planning to use XML-RPC protocol. In this case it will be easy to scale it and add new front end application or connect another projects to this (I believe it). I have main question, -- what can I use to make it easy build first tier? Maybe there is some framework good for that? And what do you think about this whole architecture. Because I'm filling that I'm thinking in Java terms developing in Python. Maybe there is some another idioms in Python world for such situations. Thanks for you time and help. P. S. Some links for reading are welcome.
Multi tier architecture implementation on Python
5,880,567
0
0
3,223
0
python
You should checkout the Turbogears framework as it is composed of several popular components: ORM with sqlalchemy, pylons for logic and support for WSGI, permits support for several templating engines for the frontend... endless. I use it for several web-services behind AJAX-enabled front-ends (like Flex-based apps, among others). You can front end the TG2-based webapp with apache or your favorite WSGI-enabled web server too. Checkout their website since they have a tutorial to setup a wiki in 20 minutes. Cheers!
0
0
0
0
2011-05-04T08:10:00.000
2
0
false
5,880,438
0
0
1
2
I need to create web application, which can be reached by user as regular web site and as XML-RPC web service. Also web site should have mobile version. I'm planning to use next technologies: Django (for web frontends (regular and mobile)). Pyramid (for web service). SQLAlchemy, Memcached (for persistence level) Later other projects can reach this data and providing logic, so I think it is better to make two tiers. I see it in next way: Tier 1. Main logic service level. This level will provide API for frontend applications (Django powered web site, for example). Tier 2. Different mostly end client applications (web site, API for remote client devices). For communication between this tiers I'm planning to use XML-RPC protocol. In this case it will be easy to scale it and add new front end application or connect another projects to this (I believe it). I have main question, -- what can I use to make it easy build first tier? Maybe there is some framework good for that? And what do you think about this whole architecture. Because I'm filling that I'm thinking in Java terms developing in Python. Maybe there is some another idioms in Python world for such situations. Thanks for you time and help. P. S. Some links for reading are welcome.
jasper reports server?
5,889,020
1
2
2,934
0
python,jasper-reports
Is this scenario plausible with current jasper reports software (open source or similar), Yes. could it be done Yes. and what would be steps in the right direction ? Write a web server in Python. Your web server will allow a user to enter information on a web site and after submitting, data would be transfered to jasper reports server and pdf would be created. Your web server would provide the PDF back to the user. You need to pick a framework, install the components, write the unit tests, write the code, debug the code and transition the code to production. It's hard (given the question) to determine what part of this you actually need help with.
0
0
0
0
2011-05-04T18:59:00.000
3
1.2
true
5,888,515
0
0
1
1
I would like to generate reports in pdf format with following scenario: people would enter information on a web site and after submitting, data would be transfered to jasper reports server and pdf would be created. Python would be language of choice for my task. Is this scenario plausible with current jasper reports software (open source or similar), could it be done, and what would be steps in the right direction ?
Delete duplicates from GoogleAppEngine Model?
5,890,205
3
4
453
0
python,google-app-engine,google-cloud-datastore,duplicates
Quick? Probably not. If you did want to delete dupes, my approach would be to write a remote_api script. Query the model for all entities, sort by title, and fetch batches of 100. Keep a local Python dictionary of titles. If you encounter a new title, add it to the dictionary. If you encounter a known title, add the entity to a delete batch, and flush the deletes before moving on to the next query batch. Probably an excessive amount of work when you can just wipe out your datastore and re-import instead.
0
1
0
0
2011-05-04T21:21:00.000
1
1.2
true
5,890,023
0
0
1
1
I have two Google App Engine Models. I ran my cron's a few times and now there are duplicate entries in my datastore. If it was easy to just delete my entire datastore and upload my data again I would. BUT it took 4 hours to upload last time so I am wondering is there a quick way of deleting entries with duplicate names in the "title" field within the model?
how to combine django and wordpress based on ubuntu and nginx
5,914,160
1
1
1,879
0
python,django,wordpress
If you can get away with running Django and Wordpress as separate apps, you can just use nginx to handle which requests go to which app. For example, if the CMS portion you'd like Wordpress for is only a blog, you could have nginx send example.com/blog/ to wordpress, and anything else to django.
0
0
0
0
2011-05-05T09:50:00.000
4
0.049958
false
5,895,707
0
0
1
1
now I have a site which based on django(the python framework) which can run stable. in this site we need to use wordpress as a cms. the server config on ubuntu and nginx, but i don't know how to combine the django and wordpress together.any tips is wonderful. thanks in advance!
Wrong encoding with Python BeautifulSoup + MySql
5,903,100
2
2
693
1
python,mysql,encoding,urllib2,beautifulsoup
BeautifulSoup returns all data as unicode strings. First triple check that the unicode strings are ccorrect. If not then there is some issue with the encoding of the input data.
0
0
0
0
2011-05-05T19:12:00.000
2
0.197375
false
5,902,914
0
0
1
1
I'm working with the BeautifulSoup python library. I used the urllib2 library to download the HTML code from a page, and then I have parsed it with BeautifulSoup. I want to save some of the HTML content into a MySql table, but I'm having some problems with the encoding. The MySql table is encoded with 'utf-8' charset. Some examples: When I download the HTML code and parse it with BeautifulSoup I have something like: "Ver las \xc3\xbaltimas noticias. Ent\xc3\xa9rate de las noticias de \xc3\xbaltima hora con la mejor cobertura con fotos y videos" The correct text would be: "Ver las últimas noticias. Entérate de las noticias de última hora con la mejor cobertura con fotos y videos" I have tried to encode and decode that text with multiple charsets, but when I insert it into MySql I have somethig like: "Ver las últimas noticias y todos los titulares de hoy en Yahoo! Noticias Argentina. Entérate de las noticias de última hora con la mejor cobertura con fotos y videos" I'm having problems with the encoding, but I don't know how to solve them. Any suggestion?
How to set up Apache server via an FTP account
5,907,442
1
1
347
0
django,apache,apache2,mod-python
If you only have user level access to the machine (ie: you don't have root), then you won't be able to control what web server runs and you can only control its settings to a limited regard. You will have to consider contacting your provider or looking for a different hosting package if the server doesn't meet you needs. Typically, if it is a hosting server, the administrators will already have web server software like Apache running. You simply just have to upload what you would like to have displayed (typically to a directory called "public_html" or something like that), and it will display when someone visits your site. Hopefully they support things like Django, otherwise you might need to look at other options. Your hosting provider is most likely to have specific and the most relevant instructions for how to upload your website.
0
0
0
0
2011-05-06T05:51:00.000
1
1.2
true
5,907,312
0
0
1
1
I have developed a web application in Django and would like to go online i have an FTP access to the hosting server I am a beginner to "setting up a website" i would like to know how to install apache on that server and have my application working Kindly provide detailed info as i am newbie, any links or tutorials would help a lot Thanks in advance
Load form data in JavaScript and run something client side
5,922,070
0
1
248
0
javascript,python
It's very unclear what you are looking for. If the question is about server push keywords are WebSockets,Socket.io,Ajax,Comet,Bayeux to start with
0
0
0
0
2011-05-07T15:29:00.000
1
1.2
true
5,922,032
0
0
1
1
The original framework of my app (using Python) is below: user key in keywords in forms. App use the data in forms as parameter to get some results from third-party website. The result which is from third-party website will be analyzed in my app. Then show the result of analyze to user. But there are some problems between my app and third-party website, so I want to change the framework of my app. user key in keywords in forms. store the keywords which in forms as cookie. automatically download one javascript which in my app (website), and run the javascript in user's computer. the javascript will get result from third-party website, and then sent the result to my app. my app will analyze the result (from third-party website) and then show the result of analyze to user. I want to know how can I do this, or what keyword should I search in Google.
Python + Django or PHP + Zend Framework
5,932,770
3
3
3,066
0
php,python,django,performance,zend-framework
There is no direct one-to-one step or howto available for migrating PHP+Zend to Python+Django as both are different, different languages and different design models. So, migration is not easy. For other comparison questions you have asked, the answer is it depends upon the use case. But just in case you are comparing for the project which you are going to undertake, go ahead with the one you are more familiar with and if you planning to start, then the answer will depend upon the camp you are asking. PHP camp will say start with PHP and it's framework and Python camp will say start with Python and Django. So, this is subjective too.
0
0
0
0
2011-05-09T05:07:00.000
1
1.2
true
5,932,747
0
0
1
1
when building a web 2.0 application, which one is superior in terms of performance availability of features documentation ease of use Python + Django combination or PHP + Zend combination? Also how easy it is to migrate one to another, so if I have written stuff for PHP + Zend combination how easy is it to move them to the Python + Django option?
How to call a javascript method from python on SL4A?
5,939,196
2
1
618
0
javascript,android,python,sl4a
You'll need to wait for a refresh event (this would be a custom event) in your JavaScript that is waiting for an event posted from your Python script. The only communication layer between JavaScript and Python is via events.
0
0
0
0
2011-05-09T08:20:00.000
1
1.2
true
5,934,326
0
0
1
1
I am writing an Android app using Python and SL4A. The app uses a webview that I wish to refresh. I plan on doing this by utilising javascript location.replace() within a wrapping doRefresh() javascript function. The problem I have is that I do not know how to call the javascript function from within my main event loop within the Python code. Is there a way to directly call the method? or Is there a way to indirectly call the method say via a button's onClick and a mimic screen tap? Thanks.
Google App Engine : alternate method of get_by_id()
5,989,456
1
1
814
0
python,google-app-engine
The problem disappear by itself after the 2011-05-10, which is the v1.5 launch date. Not sure this problem is related. I didn't change any code, as the get_by_id() was fine all the while and on this few days. Beside, I added a cron job to run the get_by_id() every minutes and try to get the instance alive. From my observation, the get_by_id() failed because it couldn't query the datastore. Btw, the setting of datastore is Master/Slave Replication.
0
1
0
0
2011-05-10T06:41:00.000
4
1.2
true
5,946,170
0
0
1
3
By given an entity ID , I will query by models = Model.get_by_id(id). However, I find out that some time it will not return result collectly. Is there any alternative or recommended method to query by entity ID in Google App Engine, python?
Google App Engine : alternate method of get_by_id()
5,949,477
3
1
814
0
python,google-app-engine
If Model.get_by_id(id) returns None, this indicates that you've supplied an invalid ID, not that the method itself is unreliable. It's not inconceivable that this method could fail in the event of a system outage, but if it did, your call would throw a datastore exception, not return an empty result.
0
1
0
0
2011-05-10T06:41:00.000
4
0.148885
false
5,946,170
0
0
1
3
By given an entity ID , I will query by models = Model.get_by_id(id). However, I find out that some time it will not return result collectly. Is there any alternative or recommended method to query by entity ID in Google App Engine, python?
Google App Engine : alternate method of get_by_id()
5,946,313
0
1
814
0
python,google-app-engine
get_by_id() always get the object, if the passed object is a valid id of object and if the objects exists in the datastore. id can be got by object.key.id in the templat else you always have the object.get(key).
0
1
0
0
2011-05-10T06:41:00.000
4
0
false
5,946,170
0
0
1
3
By given an entity ID , I will query by models = Model.get_by_id(id). However, I find out that some time it will not return result collectly. Is there any alternative or recommended method to query by entity ID in Google App Engine, python?
Send Data From Flex to Python (GAE)
5,948,044
1
0
181
0
python,apache-flex,google-app-engine,google-cloud-datastore
Have flex send a request to the Python server. COuld be a form post or JSON data or whatever.
0
1
0
0
2011-05-10T09:05:00.000
3
1.2
true
5,947,727
0
0
1
1
I'm working on a project that runs off Google App Engine (Python) which stores various user details inside GAE's datastore. I have Flex content which users can use and once done the Flex app needs to send data to the Python backend to 'mark' the user off for that task. Any suggestions?
Secure python web app
5,947,923
0
0
517
0
python,security,web-applications
Easiest and most secure: Put Apache or Nginx in front of it with an HTTPS proxy. Update: Or VPN access as suggested by Jakob. Good idea.
0
1
0
1
2011-05-10T09:16:00.000
2
1.2
true
5,947,849
0
0
1
2
i have python web app build on top of BaseHTTPServer, which runs on specyfic port. It runs system commands and shows output. I want do limit access to this app. What are posible ways to do it? Requirements: it must not be limited to LAN simple to implement/deploy
Secure python web app
5,947,916
0
0
517
0
python,security,web-applications
Common methods: VPN access. Firewalls, logging, denyhosts style defences, complicated root passwords, no su, run as its own user. (if it was my personal server) Logic bombs
0
1
0
1
2011-05-10T09:16:00.000
2
0
false
5,947,849
0
0
1
2
i have python web app build on top of BaseHTTPServer, which runs on specyfic port. It runs system commands and shows output. I want do limit access to this app. What are posible ways to do it? Requirements: it must not be limited to LAN simple to implement/deploy
determining URL that forwarded
5,951,213
1
1
199
0
python,google-app-engine,url
If by forwarding you mean HTTP redirection, you can check the Referer header. If you mean DNS resolving (e.g. distinguishing between your application being invoked via your own domain and .appspot.com one), there is SERVER_NAME environment variable (os.environ["SERVER_NAME"]) that stores the domain (e.g. www.example.com) used to issue the request.
0
1
0
0
2011-05-10T13:44:00.000
3
0.066568
false
5,951,035
0
0
1
1
I have a series of different domain names that I would like to all point (via URL forwarding from my domain host) to a google app engine application that reads what the forwarding URL is. So if the domain typed in was original XYZ.com, then when I am forwarded to my application, I can return what that original domain name was. I'm using the python variant. How best can I do this without coding for each and every variant?
What does INSTALLED_APPS setting in Django actually do?
5,958,915
10
8
7,298
0
python,django
yes. INSTALLED_APPS helps django to sync the database, run tests, get the urls to work and more related issues. Maybe your installed apps still works because the main one calls the others with imports, a django app is nothing more that a simple python module that is imported when called in the settings file, that's why you get a invalid syntax error after you run the development server because an import won't work with invalid syntax.
0
0
0
0
2011-05-11T03:23:00.000
1
1.2
true
5,958,882
0
0
1
1
What does this actually do? I recently branched out my project from 1 app into 6 different apps and forgot to update the INSTALLED_APPS part of my settings file. Everything still works even though I didn't list the new apps in. Is that supposed to happen? Do I need to include all my apps in INSTALLED_APPS?
Django: saving data from user input and display
5,959,856
3
0
579
0
python,django
Use the safe filter only if you html-escape the data first. Otherwise you should use escape. If you want your users to be able to input data with html tags you could try to sanitize the input to prevent users from using <iframe>, <script>, etc, but allow other tags to be white-listed, and then mark it as safe.
0
0
0
0
2011-05-11T05:12:00.000
1
1.2
true
5,959,553
0
0
1
1
I have a form with a jwysiwyg editor. Looking at it, it can use basic-formatting html tags using the formatting buttons like SO's. Upon submitting the form, I notice its saved into the database as-is, whereas if I enter stuff like <iframe> ... </iframe> into the editor I notice that it is html-encoded inside the table. Now, when I need to output whatever the user has submitted, can I safely use {{ output|safe }} to display the formatted text? Is this reasonably secure enough or how should I rectify?
Uninstalling a python module in ubuntu
5,959,706
10
5
6,576
0
python,django,uninstallation
go to the python shell >> import django django.__path__ copy the path on the shell sudo rm -r path
0
0
0
0
2011-05-11T05:25:00.000
2
1.2
true
5,959,647
1
0
1
1
I have to delete a python module named "django" (a popular one), because I installed the wrong version (1.3 - beta in py-2.6). How to uninstall this module? Please explain, because I've used python only in Windows and never in Ubuntu.
Scraping ASP.NET with Python and urllib2
5,974,002
1
2
1,706
0
asp.net,python,asp.net-ajax,screen-scraping,urllib2
When scraping a web application, I use either: 1) WireShark ... or... 2) A logging proxy server (that logs headers as well as payload) I then compare what the real application does (in this case, how your browser interacts with the site) with the scraper's logs. Working through the differences will bring you to a working solution.
0
0
1
1
2011-05-12T04:17:00.000
2
0.099668
false
5,973,245
0
0
1
2
I've been trying (unsuccessfully, I might add) to scrape a website created with the Microsoft stack (ASP.NET, C#, IIS) using Python and urllib/urllib2. I'm also using cookielib to manage cookies. After spending a long time profiling the website in Chrome and examining the headers, I've been unable to come up with a working solution to log in. Currently, in an attempt to get it to work at the most basic level, I've hard-coded the encoded URL string with all of the appropriate form data (even View State, etc..). I'm also passing valid headers. The response that I'm currently receiving reads: 29|pageRedirect||/?aspxerrorpath=/default.aspx| I'm not sure how to interpret the above. Also, I've looked pretty extensively at the client-side code used in processing the login fields. Here's how it works: You enter your username/pass and hit a 'Login' button. Pressing the Enter key also simulates this button press. The input fields aren't in a form. Instead, there's a few onClick events on said Login button (most of which are just for aesthetics), but one in question handles validation. It does some rudimentary checks before sending it off to the server-side. Based on the web resources, it definitely appears to be using .NET AJAX. When logging into this website normally, you request the domian as a POST with form-data of your username and password, among other things. Then, there is some sort of URL rewrite or redirect that takes you to a content page of url.com/twitter. When attempting to access url.com/twitter directly, it redirects you to the main page. I should note that I've decided to leave the URL in question out. I'm not doing anything malicious, just automating a very monotonous check once every reasonable increment of time (I'm familiar with compassionate screen scraping). However, it would be trivial to associate my StackOverflow account with that account in the event that it didn't make the domain owners happy. My question is: I've been able to successfully log in and automate services in the past, none of which were .NET-based. Is there anything different that I should be doing, or maybe something I'm leaving out?
Scraping ASP.NET with Python and urllib2
6,035,498
2
2
1,706
0
asp.net,python,asp.net-ajax,screen-scraping,urllib2
For anyone else that might be in a similar predicament in the future: I'd just like to note that I've had a lot of success with a Greasemonkey user script in Chrome to do all of my scraping and automation. I found it to be a lot easier than Python + urllib2 (at least for this particular case). The user scripts are written in 100% Javascript.
0
0
1
1
2011-05-12T04:17:00.000
2
1.2
true
5,973,245
0
0
1
2
I've been trying (unsuccessfully, I might add) to scrape a website created with the Microsoft stack (ASP.NET, C#, IIS) using Python and urllib/urllib2. I'm also using cookielib to manage cookies. After spending a long time profiling the website in Chrome and examining the headers, I've been unable to come up with a working solution to log in. Currently, in an attempt to get it to work at the most basic level, I've hard-coded the encoded URL string with all of the appropriate form data (even View State, etc..). I'm also passing valid headers. The response that I'm currently receiving reads: 29|pageRedirect||/?aspxerrorpath=/default.aspx| I'm not sure how to interpret the above. Also, I've looked pretty extensively at the client-side code used in processing the login fields. Here's how it works: You enter your username/pass and hit a 'Login' button. Pressing the Enter key also simulates this button press. The input fields aren't in a form. Instead, there's a few onClick events on said Login button (most of which are just for aesthetics), but one in question handles validation. It does some rudimentary checks before sending it off to the server-side. Based on the web resources, it definitely appears to be using .NET AJAX. When logging into this website normally, you request the domian as a POST with form-data of your username and password, among other things. Then, there is some sort of URL rewrite or redirect that takes you to a content page of url.com/twitter. When attempting to access url.com/twitter directly, it redirects you to the main page. I should note that I've decided to leave the URL in question out. I'm not doing anything malicious, just automating a very monotonous check once every reasonable increment of time (I'm familiar with compassionate screen scraping). However, it would be trivial to associate my StackOverflow account with that account in the event that it didn't make the domain owners happy. My question is: I've been able to successfully log in and automate services in the past, none of which were .NET-based. Is there anything different that I should be doing, or maybe something I'm leaving out?
asynchronous file upload with ajaxupload to a tornado web server
5,989,216
2
3
1,836
1
python,file-upload,tornado,ajax-upload
I got the answer. I need to use self.request.body to get the raw post data. I also need to pass in the correct _xsrf token, otherwise tornado will fire a 403 exception. So that's about it.
0
1
0
0
2011-05-12T19:00:00.000
1
1.2
true
5,983,032
0
0
1
1
I'm using this javascript library (http://valums.com/ajax-upload/) to upload file to a tornado web server, but I don't know how to get the file content. The javascript library is uploading using XHR, so I assume I have to read the raw post data to get the file content. But I don't know how to do it with Tornado. Their documentation doesn't help with this, as usual :( In php they have something like this: $input = fopen("php://input", "r"); so what's the equivalence in tornado?
ImportError: cannot import name signals
5,986,697
3
7
16,619
0
python,django,unit-testing,importerror
I had the same problem just a minute ago. Investigating I realized the problem was with my settings.py* file. Check if you are having problems with Django finding your settings file correctly. This error message is totally non-sense. * IIRC Django looks for settings.py file, if not found, it looks for environment variable DJANGO_SETTINGS_MODULE and try that.
0
0
0
0
2011-05-12T19:06:00.000
3
0.197375
false
5,983,100
0
0
1
3
I'm using Django 1.3.0 with Python 2.7.1. In every test I write the following imports I get the importError above: from django.utils import unittest from django.test.client import Client The full stack trace: File "C:\Program Files (x86)\j2ee\plugins\org.python.pydev.debug_1.6.3.2010100513\pysrc\runfiles.py", line 342, in __get_module_from_str mod = __import__(modname) File "C:/Users/benjamin/workspace/BookIt/src/BookIt/tests\basic_flow.py", line 11, in from django.test.client import Client File "C:\Python27\lib\site-packages\django\test\__init__.py", line 5, in from django.test.client import Client, RequestFactory File "C:\Python27\lib\site-packages\django\test\client.py", line 21, in from django.test import signals ImportError: cannot import name signals ERROR: Module: basic_flow could not be imported. Any ideas why this happening ?
ImportError: cannot import name signals
6,003,401
5
7
16,619
0
python,django,unit-testing,importerror
@Hugo was right in that it was a settings.py problem. But I didn't had that problem when running through the Django environment. But when I wanted to run unit tests one by one (By using Pydev's run as unittest) it failed to run. What I needed to do was to add the Django settings module information, so for now what I'm doing is adding the following lines to my unit tests: from django.core import management; import BookIt.settings as settings; management.setup_environ(settings) This loads my Django project settings and allow me to run as regular unittest. If anyone has better suggestion on how to configure this more cleanly in Pydev please let me know.
0
0
0
0
2011-05-12T19:06:00.000
3
1.2
true
5,983,100
0
0
1
3
I'm using Django 1.3.0 with Python 2.7.1. In every test I write the following imports I get the importError above: from django.utils import unittest from django.test.client import Client The full stack trace: File "C:\Program Files (x86)\j2ee\plugins\org.python.pydev.debug_1.6.3.2010100513\pysrc\runfiles.py", line 342, in __get_module_from_str mod = __import__(modname) File "C:/Users/benjamin/workspace/BookIt/src/BookIt/tests\basic_flow.py", line 11, in from django.test.client import Client File "C:\Python27\lib\site-packages\django\test\__init__.py", line 5, in from django.test.client import Client, RequestFactory File "C:\Python27\lib\site-packages\django\test\client.py", line 21, in from django.test import signals ImportError: cannot import name signals ERROR: Module: basic_flow could not be imported. Any ideas why this happening ?