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
Unable to get Python to POST on html
16,411,935
2
0
299
0
python,html,google-app-engine
You're getting '405 method not allowed' because the POST is going to the same url that served up the page, but the handler for that path (MainPage) does not have a post method. That's the same diagnosis that you were given when you asked this question two hours earlier under a different user id. Stepping back further to address the "what have I done wrong" question: It seems to me that you've gotten quite far along before discovering that what you have doesn't work. So far along that the example is cluttered with irrelevant code that's unrelated to the failure. That makes it harder for you for figure this out for yourself, and it makes it more difficult for people here to help you. In this situation, you help yourself (and help others help you) by seeing how much code you can eliminate while still demonstrating the failure.
0
0
0
0
2013-05-07T04:19:00.000
1
0.379949
false
16,411,136
0
0
1
1
I've been trying to get my python code to post. I have tried using the Postman Plugin to test the post method and I would get a 405 method error. I am planning to have the user post the information and have it displayed. Currently if I press submit I would get a error loading page, changing the form to get results in the submit button working and returning to the previous page. If I change the handler to post the screen would instantly display '405 Method Not Allowed'. I've looked through the Google App Engine logs and there are no errors. Can someone help me with what I done wrong and advise me on how to the post method functioning? Thanks for the time.
Managing Django project with mercurial and PyCharm - choosing root folder
16,415,301
2
0
207
0
python,django,mercurial,pycharm
I assume you use Django >= 1.4. When you create a Django project using this Django version, by default it creates a folder with manage.py and inside it a subfolder with settings.py. What you should do is to use the folder with manage.py as the root for your PyCharm project and Mercurial repo. This way all your applications will be in the project and repo. If you don't want your PyCharm settings to be tracked by Mercurial, do not forget to add .idea folder to your .hgignore file.
0
0
0
0
2013-05-07T06:41:00.000
1
0.379949
false
16,412,763
1
0
1
1
What is best/preferred/right/conventional way: - Root of repository and PyCharm project = Django project folder with settings.py - Root of repo and PyCharm project is the parent directory of Django project. Never used Hg before, and this simple problem is hinder me.
Django - overriding save/delete functions of the model vs doing it in the view
16,412,820
6
1
107
0
python,django,django-models,django-views
The general consensus is, thick models and helpers, thin views. In other words, your views should be as simple as possible; your models as rich as possible, and plenty of helper code for the outlying bits. Also keep in mind that if you override the model methods, you are offering a sort of "guarantee" that no matter how the ORM is accessed, your rules will be applied. If you do the logic only in the view, then anywhere else; for example using custom management commands or the django shell, a template tag, or even in another view, there is a chance that your rules will not be applied.
0
0
0
0
2013-05-07T06:41:00.000
1
1.2
true
16,412,772
0
0
1
1
I have a model Quote, which has a foreign key to the user model. A user can have between 0 and 10 quotes, and if there s/he has one or more quotes, one of them should be the primary quote(primary is a field of the Quote model). When a quote is added by the user, it is checked whether the user has other quotes, if not the new quote is set as the primary. And when the primary quote is deleted another quote is set as the primary quote, if the user has any other quotes. Right now I do this in the respective views. I was wondering whether it would better to override the save and delete functions of the model and do all of this there. So which is the right place to perform these tasks the model or the view?
Which one is better to create a web application? web2py or cherrypy
16,431,335
1
2
1,858
0
javascript,python,web2py,cherrypy
web2py is using MVC model and each of the scripts are nicely separated. It can be deployed at pythoneverywhere.com. not too sure about cherrypy.
0
0
0
1
2013-05-08T01:27:00.000
2
0.099668
false
16,431,207
0
0
1
1
I am using Raspberry Pi to function as a mini web server. At first, i came across web2py and started to learn it. It was tough for a beginner like me. Later, a friend in a forum introduced CherryPy to me and i started to work on the web application skeleton that he gave me. Soon, I abandoned web2py and proceeded with cherrypy as it is fairly straightforward. Somehow, I think web2py could be a good choice too. Web application for both are written in python, with html, css and javascripts. So whatever i've done using cherrypy may be possible to transfer over to web2py. (is it true?) I would like to find out what are the main differences between those 2 and their respective pros and cons. I hope to find out more about fellow users' experiences in using web2py and cherrypy. In such way, future visitors can make a comparison before they proceed in choosing which one to use. Thank you!
data bridge between Java and Python daemons
16,444,115
1
1
368
0
java,python,database,distributed-computing,in-memory-database
Given the relatively low volume of data you need, I would say the easiest way would be to use a TCP socket to communicate between the two processes. The data speed on the loopback interface is more than enough for your needs.
0
1
0
0
2013-05-08T05:05:00.000
3
0.066568
false
16,433,047
0
0
1
1
I have two background processes running on linux machine. One is Java and second one is in Python. What would be most efficient way to exchange data between these two apps ? I am talking about text / images data below < 10Mb approx each 5 minutes (not streamed). Due high cost of refactoring we cannot migrate fully to Python (or Java). Natural choice is filesystem or local networking but what about in memory database (sqllite/redis/...) ? Filesystem handling or network handling is sometimes painfull i guess. Do you think that in-memory-DB would be good option for such task ? Jython is not option there as not all Python libraries are compatible... Environment : ubuntu server 12.04 64bit, Python 2.7, Java 7
flask application timeout with amazon load balancer
17,628,337
0
7
1,897
0
python,flask,gunicorn,werkzeug
The easiest way is to force all connections is to make sure you are using HTTP/1.0 and not adding the header Connection: Keep-Alive to the response. Please checkout werkzeug.http.remove_hop_by_hop_headers().
0
0
0
0
2013-05-08T15:09:00.000
4
0
false
16,444,190
0
0
1
4
I'm trying to use a Flask application behind an Amazon Load Balancer and the Flask threads keep timing out. It appears that the load balancer is sending a Connection: keep-alive header and this is causing the Flask process to never return (or takes a long time). With gunicorn in front the processes are killed and new ones started. We also tried using uWSGI and simply exposign the Flask app directly (no wrapper). All result in the Flask process just not responding. I see nothing in the Flask docs which would make it ignore this header. I'm at a loss as to what else I can do with Flask to fix the problem. Curl and direct connections to the machine work fine, only those via the load balancer are causing the problem. The load balancer itself doesn't appear to be doing anything wrong and we use it successfully with several other stacks.
flask application timeout with amazon load balancer
17,667,952
1
7
1,897
0
python,flask,gunicorn,werkzeug
Did you remember to set session.permanent = True and app.permanent_session_lifetime?
0
0
0
0
2013-05-08T15:09:00.000
4
0.049958
false
16,444,190
0
0
1
4
I'm trying to use a Flask application behind an Amazon Load Balancer and the Flask threads keep timing out. It appears that the load balancer is sending a Connection: keep-alive header and this is causing the Flask process to never return (or takes a long time). With gunicorn in front the processes are killed and new ones started. We also tried using uWSGI and simply exposign the Flask app directly (no wrapper). All result in the Flask process just not responding. I see nothing in the Flask docs which would make it ignore this header. I'm at a loss as to what else I can do with Flask to fix the problem. Curl and direct connections to the machine work fine, only those via the load balancer are causing the problem. The load balancer itself doesn't appear to be doing anything wrong and we use it successfully with several other stacks.
flask application timeout with amazon load balancer
17,648,222
8
7
1,897
0
python,flask,gunicorn,werkzeug
The solution I have now is using gunicorn as a wrapper around the flask application. For the worker_class I am using eventlet with several workers. This combination seems stable and responsive. Gunicorn is also configured for HTTPS. I assume it is a defect in Flask that causes the problem and this is an effective workaround.
0
0
0
0
2013-05-08T15:09:00.000
4
1.2
true
16,444,190
0
0
1
4
I'm trying to use a Flask application behind an Amazon Load Balancer and the Flask threads keep timing out. It appears that the load balancer is sending a Connection: keep-alive header and this is causing the Flask process to never return (or takes a long time). With gunicorn in front the processes are killed and new ones started. We also tried using uWSGI and simply exposign the Flask app directly (no wrapper). All result in the Flask process just not responding. I see nothing in the Flask docs which would make it ignore this header. I'm at a loss as to what else I can do with Flask to fix the problem. Curl and direct connections to the machine work fine, only those via the load balancer are causing the problem. The load balancer itself doesn't appear to be doing anything wrong and we use it successfully with several other stacks.
flask application timeout with amazon load balancer
17,656,907
0
7
1,897
0
python,flask,gunicorn,werkzeug
Do you need an HTTP load balancer? Using a layer 4 balancer might just as well solve your problem, because it does not interfere with higher protocol levels.
0
0
0
0
2013-05-08T15:09:00.000
4
0
false
16,444,190
0
0
1
4
I'm trying to use a Flask application behind an Amazon Load Balancer and the Flask threads keep timing out. It appears that the load balancer is sending a Connection: keep-alive header and this is causing the Flask process to never return (or takes a long time). With gunicorn in front the processes are killed and new ones started. We also tried using uWSGI and simply exposign the Flask app directly (no wrapper). All result in the Flask process just not responding. I see nothing in the Flask docs which would make it ignore this header. I'm at a loss as to what else I can do with Flask to fix the problem. Curl and direct connections to the machine work fine, only those via the load balancer are causing the problem. The load balancer itself doesn't appear to be doing anything wrong and we use it successfully with several other stacks.
How to run Three different websites in single Django project
16,456,275
1
1
84
0
python,django
I have tried your scenario...I have included a flag variable to settings.py you can set flag values to 1,2 or 3 and based on the flag values you can then load templates and static DIR...then you can use same views.py,urls.py,models.py....but make sure you use the app's DB file for the all three websites but name can be changed....as it is app's specific and if you use another app's DB file you will get error...Hope it helps...
0
0
0
0
2013-05-08T16:36:00.000
1
1.2
true
16,445,795
0
0
1
1
I want to run Three websites in single Django project... Site_1,Site_2,Site_3 has same models.py,same views.py and same urls.py file.. But different sqlite.db file..different template Dir.will it be possible to run sites under this scenario
Any advantage of using node.js for task queue worker instead of other languages?
16,471,242
0
2
1,154
0
php,python,ruby,node.js,redis
I have used Node.js for task worker for jobs that call runnable webpages written in PHP or running commands on certain hosts. In both these instances Node is just initializing (triggering) the job, waiting for and then evaluating the result. The heavy lifting / CPU intensive work is done by another system / program. Hope this helps!
0
1
0
1
2013-05-09T07:31:00.000
2
0
false
16,456,682
0
0
1
1
Will i have any advantage of using Node.js for task queue worker instead of any other language, like PHP/Python/Ruby? I want to learn Redis for simple task queue tasks like sending big ammounts of email and do not want keeping users to wait for establishing connection etc. So the questions is: does async nature of node.js help in this scenario or is it useless? P.S. i know that node is faster than any of this language in memory consumption and computation because of effecient V8 engine, maybe it's possible to win on this field?
Can't connect to localhost:8080 when trying to run Google App Engine program
18,885,291
1
1
10,838
0
google-app-engine,python-2.7
I have to manually start python and make it point to my app folder, for instance in a command line window on Windows I am using python. I installed python in C:\Python27 and my sample app is in c:\GoogleApps\guestbook C:\Python27>dev_appserver.py c:\GoogleApps\guestbook and then I can start my app in the Google App Engine Launcher and hit localhost 8080
0
1
0
0
2013-05-10T02:00:00.000
5
0.039979
false
16,474,027
0
0
1
2
I'm trying to run the Google App Engine Python 2.7 Hello World program and view it in a browser via Google App Engine Launcher. I followed the install and program instructions to the letter. I copied and pasted the code in the instructions to the helloworld.py file and app.yam1 and verified that they are correct and in the directory listed as the application directory. I hit run on the launcher and it runs with no errors, although I get no sign that is has completed (orange clock symbol next to app name). I get the following from the logs: Running dev_appserver with the following flags: --skip_sdk_update_check=yes --port=8080 --admin_port=8000 Python command: /opt/local/bin/python2.7 When I try to open in the browser via the GAE Launcher, the 'browse' icon is grayed out and the browser won't open. I tried opening localhost:8080 in Firefox and Chrome as the tutorial suggests, but I get unable to connect errors from both. How can I view Hello World in a browser? Is there some configuration I need to make on my machine?
Can't connect to localhost:8080 when trying to run Google App Engine program
18,226,152
1
1
10,838
0
google-app-engine,python-2.7
I had the same problem. This seemed to fix it: cd to google_appengine, run python dev_appserver.py --port=8080 --host=127.0.0.1 /path/to/application at this point there is a prompt to allow updates on running, I said Yes. At this point the app was running as it should, also when I quit this and went in using the launcher again, that worked too.
0
1
0
0
2013-05-10T02:00:00.000
5
0.039979
false
16,474,027
0
0
1
2
I'm trying to run the Google App Engine Python 2.7 Hello World program and view it in a browser via Google App Engine Launcher. I followed the install and program instructions to the letter. I copied and pasted the code in the instructions to the helloworld.py file and app.yam1 and verified that they are correct and in the directory listed as the application directory. I hit run on the launcher and it runs with no errors, although I get no sign that is has completed (orange clock symbol next to app name). I get the following from the logs: Running dev_appserver with the following flags: --skip_sdk_update_check=yes --port=8080 --admin_port=8000 Python command: /opt/local/bin/python2.7 When I try to open in the browser via the GAE Launcher, the 'browse' icon is grayed out and the browser won't open. I tried opening localhost:8080 in Firefox and Chrome as the tutorial suggests, but I get unable to connect errors from both. How can I view Hello World in a browser? Is there some configuration I need to make on my machine?
How to count the threads and process of WSGI?
16,480,852
2
3
1,298
0
multithreading,wsgi,python-multithreading
You mean why do you have 3 extra per mod_wsgi daemon process. For your configuration, 15 new threads will be created for handling the requests. The other 3 in a process are due to: The main thread which the process was started as. It will wait until the appropriate signal is received to shutdown the process. A monitor thread which checks for certain events to occur and which will signal the process to shutdown. A deadlock thread which checks to see if a deadlock has occurred in the Python interpreter. If it does occur, it will sent an event which thread (2) will detect. Thread (2) would then send a signal to the process to quit. That signal would be detected by thread (1) which would then gracefully exit the process and try and cleanup properly. So the extra threads are all about ensuring that the whole system is very robust in the event of various things that can occur. Plus ensuring that when the process is being shutdown that the Python sub intepreters are destroyed properly to allow atexit registered Python code to run to do its own cleanup.
0
1
0
0
2013-05-10T09:35:00.000
1
1.2
true
16,479,249
0
0
1
1
I have deployed a wsgi application on the apache and I have configured it like this: WSGIDaemonProcess wsgi-pcapi user= group= processes=2 threads=15 After I restart the apache I am counting the number of threads: ps -efL | grep | grep -c httpd The local apache is running only one wsgi app but the number I get back is 36 and I cannot understand why. I know that there are 2 processes and 15 threads which means: 15*2+2=32 So why do I have 4 more?
How can I find out which line of code is leaving a file open?
16,488,072
0
1
88
0
python,django
Are you depending on the garbage collector to close your files? I.E. the handle goes out of scope and even though you've "closed" the file, it won't go away until GC runs. If the object chain never goes out of scope, GC cannot collect it. Also, if GC does not get an opportunity to run, they won't be collected either. I ran into the same issue with a long running process, and "solved" it by redesigning my system, such that all file access happened inside of a child object. That object got removed from the reference chain after it was done being used, or some error occurred. This allowed the GC to collect the handles.
0
0
0
0
2013-05-10T17:34:00.000
2
0
false
16,487,863
0
0
1
1
I recently got an exception on my server about "Too many open files". I checked lsof, and sure enough, there are a bunch of PDF files that remain open (all in the same directory). This particular file is managed through a Django FileField. I've tried to track down any places in my project that explicitly open the file by name, and there's only one place I can find, and from what I can tell the file is being closed correctly there. There may be other places where the file is remaining open, but I have no idea how to find out what piece of code is actually keeping the file open. I've tried simply grepping for calls to open() and file(), but no luck. Is there any way to systematically track down what line of code is responsible for leaving the file open? EDIT: I understand how to properly open/close a file. My question is whether or not there is a way to track down an existing line of code that leaves is leaving a file open.
Using an alternate Scripting Language to be interpreted by the browser instead of Javascript
16,503,582
0
0
392
0
javascript,python,ruby,browser
One of the reasons you don't find browsers supporting languages like Ruby or Python, is because of the user's security. JavaScript was originally embedded in browsers for convenience, but, because that was an established relationship, as security issues occurred, JavaScript was locked down, as was the browser, to remove the capability of accessing the user's file system. Other languages would have to be stripped of their ability to read/write from the disk before they would be allowed into a browser. Java applets can be created that can access the disk, but they're supposed to be signed to prove they're safe. A similar mechanism could be created for other languages, but since JavaScript and Java applets exist, I'm not sure the movement for supporting other languages would gain much support.
0
0
0
0
2013-05-12T01:10:00.000
3
0
false
16,503,242
0
0
1
1
Can a scripting language like Python or Ruby replace Javascript as the browser's interpreted language so that we could be writing .py or .rb files instead of .js for frontend work? If so, would that be a good idea? If not, why? If it's a good idea, why isn't it done that way? If Python/Ruby can't replace JS in the browser, why not?
Running a Python interpreter from Rails
16,525,800
0
3
73
0
python,ruby-on-rails
Right now I am using Flask with localtunnel. It works.
0
0
0
0
2013-05-12T05:26:00.000
1
0
false
16,504,470
0
0
1
1
I have a webapp that is built in Rails, but I'm working with graphs and Python has far better graph libraries (namely, Graph-Tool). There are on the order of 10k lines of code written already, so it would be a hassle to switch to Django. However, the work I'm doing involves querying very, very large graphs, ones that would take a lot of time to load into the interpreter. Is there a way to have a Python interpreter somewhere that Rails controls, with actions like "Load the graph" and "search the graph for x" and "restart the interpreter"? These can be on separate computers. I've heard of the SOA solution, but I'm not sure how to set that up or if the interpreter stays open after calls from Rails. Can someone point me to some guide, or give me advice?
Using Extensions with Selenium (Python)
61,971,091
1
24
52,452
0
python,google-chrome,selenium,selenium-webdriver
I also needed to add an extention to chrome while using selenium. What I did was first open the browser using selenium then add extention to the browser in the normal way like you would do in google chrome.
0
0
1
0
2013-05-12T19:49:00.000
6
0.033321
false
16,511,384
0
0
1
1
I am currently using Selenium to run instances of Chrome to test web pages. Each time my script runs, a clean instance of Chrome starts up (clean of extensions, bookmarks, browsing history, etc). I was wondering if it's possible to run my script with Chrome extensions. I've tried searching for a Python example, but nothing came up when I googled this.
Formencode and empty values
16,554,536
0
0
430
0
python,formencode
I ended up moving from FormEncode to WTForms and everything is now a whole lot easier. Seems to me like Formencode wasn't very well thought out.
0
0
0
0
2013-05-13T05:20:00.000
2
1.2
true
16,515,314
0
0
1
1
How can I write a custom validator which is always executed, even when the user has submitted an empty or missing value? I've tried overriding the to_python, validate_python, _to_python, _validate_python (and more) methods but none of these seem to get run if the user has submitted an empty or None value
How to get tests coverage using Django, Jenkins and Sonar?
19,887,503
0
4
6,621
0
python,django,jenkins,code-coverage,sonarqube
On Jenkins I found that coverage.xml has paths that are relative to the directory in which manage.py jenkins is run. In my case I need to run unit tests on a different machine than Jenkins. To allow Sonar to use the generated coverage.xml, it was necessary for me to run the tests from a folder in the same spot relative to the project as the workspace directory on Jenkins. Say I have the following on Jenkins /local/jenkins/tmp/workspace/my_build + my_project + app1 + app2 Say on test machine I have the following /local/test + my_project + app1 + app2 I run unit tests from /local/test on the test machine. Then coverage.xml has the correct relative paths, which look like my_project/app1/source1.py or my_project/app2/source2.py
0
0
0
1
2013-05-13T08:46:00.000
3
0
false
16,518,002
0
0
1
1
I'm trying to get test unit coverage with Sonar. To do so, I have followed these steps : Generating report with python manage.py jenkins --coverage-html-report=report_coverage Setting properties in /sonar/sonar-3.5.1/conf/sonar.properties: sonar.dynamicAnalysis=reuseReports sonar.cobertura.reportPath=/var/lib/jenkins/workspace/origami/DEV/SRC/origami/reports/coverage.xml When I launch the tests, the reports are generated in the right place. However, no unit tests are detected by Sonar. Am I missing a step or is everything just wrong?
How can i remove the GET parameters from url in django
16,518,803
6
1
3,872
0
python,django
The whole point of GET is that they are retrieved from the URL itself, removing them from the URL removes them entirely. If you want them 'hidden' you will need to use POST.
0
0
0
0
2013-05-13T09:26:00.000
2
1
false
16,518,733
0
0
1
1
I have the form which i am showing by normal view. Then i am send the GET parameters to djnago ChangeList view like django does for lookups like this student/?region__id__exact=1&status__exact=Published now is there any way to remove that from the URL in the address bar. I don't users to see what i am doing
How to find out if an image is loaded?
16,520,285
0
0
195
0
python,django,image,django-views
This can be only by serving your images with your custom views. E.g you should write your own view that will return static resources, and you will not use a standard django static handler
0
0
0
0
2013-05-13T10:08:00.000
5
0
false
16,519,506
0
0
1
2
I have a django project which is running (for example) on localhost:8000. I have an image in this address localhost:8000/static/test.jpg . A user may open just this image by going to it's url and not open the containing page. I want to find out if this image is loaded in a user's browser (by loading the containing page or just entering the image's url) and I want to get the request object of that request. Can I have a method in my views just for that specific image? I searched through the internet but didn't find anything useful. any idea or solution?
How to find out if an image is loaded?
16,767,630
0
0
195
0
python,django,image,django-views
Your way goes fine but bot for a high traffic. In that case you can use XSendFile library witch works with Apache
0
0
0
0
2013-05-13T10:08:00.000
5
0
false
16,519,506
0
0
1
2
I have a django project which is running (for example) on localhost:8000. I have an image in this address localhost:8000/static/test.jpg . A user may open just this image by going to it's url and not open the containing page. I want to find out if this image is loaded in a user's browser (by loading the containing page or just entering the image's url) and I want to get the request object of that request. Can I have a method in my views just for that specific image? I searched through the internet but didn't find anything useful. any idea or solution?
Writing to file with SL4A Python
16,633,755
0
1
1,062
0
android,python,sl4a
Ok, so I was silly to look for a droid command to write files. The standard Python open, write, read, close commands work fine.
0
0
1
0
2013-05-13T12:49:00.000
1
1.2
true
16,522,493
0
0
1
1
Is there an API call for opening, reading and writing to text files on an Android device using SL4A and Python? If not, what options are available for persistent storage? e.g. database, preferences, dropbox, google drive.
Django-allauth loads wrong base.html template
39,067,085
1
9
2,348
0
python,django,django-allauth
Allauth tries to extend myproject/templates/base.html. The easiest ways are to move base.html to myproject/templates/site/ in order to get myproject/templates/site/base.html or simply rename base.html
0
0
0
0
2013-05-13T15:58:00.000
6
0.033321
false
16,526,314
0
0
1
3
I've been trying to get django-allauth working for a couple days now and I finally found out what was going on. Instead of loading the base.html template that installs with django-allauth, the app loads the base.html file that I use for the rest of my website. How do i tell django-allauth to use the base.html template in the virtualenv/lib/python2.7/sitepackages/django-allauth directory instead of my project/template directory?
Django-allauth loads wrong base.html template
16,526,472
7
9
2,348
0
python,django,django-allauth
Unless called directly, your base.html is an extension of the templates that you define. For example, if you render a template called Page.html - at the top you will have {% extends "base.html" %}. When defined as above, base.html is located in the path that you defined in your settings.py under TEMPLATE_DIRS = () - which, from your description, is defined as project/template. Your best bet is to copy the django-allauth base.html file to the defined TEMPLATE_DIRS location, rename it to allauthbase.html, then extend your templates to include it instead of your default base via {% extends "allauthbase.html" %}. Alternatively you could add a subfolder to your template location like project/template/allauth, place the allauth base.html there, and then use {% extends "allauth/base.html" %}.
0
0
0
0
2013-05-13T15:58:00.000
6
1.2
true
16,526,314
0
0
1
3
I've been trying to get django-allauth working for a couple days now and I finally found out what was going on. Instead of loading the base.html template that installs with django-allauth, the app loads the base.html file that I use for the rest of my website. How do i tell django-allauth to use the base.html template in the virtualenv/lib/python2.7/sitepackages/django-allauth directory instead of my project/template directory?
Django-allauth loads wrong base.html template
53,967,402
2
9
2,348
0
python,django,django-allauth
All of the answers provided force you to rewrite files and modify your own project to fit in with allauth, which is a completely unacceptable workflow. Such a third-party application should not have such manipulative power over your own project. Truly, the easiest way to handle this situation, especially based on the answers provided, is to simply move the allauth app and its associated apps to the end of your INSTALLED_APPS list in your settings.py file. Django will find your base.html template before it finds the other base.html template in the other apps listed beneath it. Problem solved.
0
0
0
0
2013-05-13T15:58:00.000
6
0.066568
false
16,526,314
0
0
1
3
I've been trying to get django-allauth working for a couple days now and I finally found out what was going on. Instead of loading the base.html template that installs with django-allauth, the app loads the base.html file that I use for the rest of my website. How do i tell django-allauth to use the base.html template in the virtualenv/lib/python2.7/sitepackages/django-allauth directory instead of my project/template directory?
Python - Can a web server avoid imporing for every request?
16,538,939
3
1
216
0
python,django,import,request,nlp
Django, under most deployment mechanism, does not import modules for every request. Even the development server only reloads code when it changes. I don't know how you're verifying that all the imports are re-run each time, but that certainly shouldn't be happening.
0
0
1
0
2013-05-13T22:39:00.000
1
1.2
true
16,532,314
0
0
1
1
I'm working on a Python project, currently using Django, which does quite a bit of NLP work in a form post process. I'm using the NLTK package, and profiling my code and experimenting I've realised that the majority of the time the code takes is performing the import process of NLTK and various other packages. My question is, is there a way I can have this server start up, do these imports and then just wait for requests, passing them to a function that uses the already imported packages? This would be much faster and less wasteful than performing such imports on every request. If anybody has any ideas to avoid importing large packages on every request, it'd be great if you could help me out! Thanks, Callum
Should I store static files (photos) local or in the cloud?
16,565,006
2
0
128
0
python,django,cloud-hosting,photo-gallery
Pros: You don't have to pay extra for your S3 servers after it crosses the 20GB limit. Cons Your server will slow down as it will not be able to take the load after certain limit. Performance of the server will go down, in worst case your servers may crash. Your node will also have limit on the disk space, which you cannot exceed but S3 or any other service will be able to do it seamlessly.
0
0
0
0
2013-05-15T12:16:00.000
1
0.379949
false
16,564,791
0
0
1
1
I have this small app in Django, hosted on cheap linode. We want to add photo-sharing functionality so I am wondering should I put all user uploaded static photo files locally on linode serwer or it is better to use Amazon S3 or similar cloud soulution ? What are pros and cons of both solutions ?
Are ModelForms in django used only for POSTing?
16,568,130
0
0
84
0
python,django,django-models,django-forms
ModelForms are for creating/updating objects. Authentication doesn't modify the model instance (the User), therefore use a normal form instead. From the docs: The save() method Every form produced by ModelForm also has a save() method. This method creates and saves a database object from the data bound to the form. A subclass of ModelForm can accept an existing model instance as the keyword argument instance; if this is supplied, save() will update that instance. If it’s not supplied, save() will create a new instance of the specified model. If you weren't going to use this save(), method and you don't need most of the model fields either (only username/email and password), you would be throwing away most of the functionality offered by the ModelForm, so why would you use it in the first place?
0
0
0
0
2013-05-15T14:26:00.000
1
1.2
true
16,567,751
0
0
1
1
ModelForms are a nice way to prevent repeating the definitions of models one creates. What I would like to do is take advantage of that feature and use it for more than just processing POST requests. I use forms a lot for validation. Example: Say you have a User model with the fields (email, password, first_name, last_name). The email field is unique and an index. UserCreationForm: uses all fields, fails validation if the email already exists. Processes POST requests UserUpdateForm: the same model, but doesn't allow to change the email. Because this field is excluded no issues there. UserAuthenticationForm: includes only the email and password fields. The problem is, this should be used for authentication and validation fails because the email already exists. Is there a way I can do this? That is, have the UserAuthenticationForm skip the email checking. Thank you.
Extracting Visual Event 2 output into script
16,579,794
0
0
67
0
javascript,python,ruby,perl
There is no way to accomplish this very oddly specific task without digging through the code, although this isn't as hard as it seems considering it's quite legible and easy to build on your own system, even if you don't have any previous experience with JavaScript.
0
0
0
1
2013-05-16T01:43:00.000
1
1.2
true
16,577,725
0
0
1
1
In the Visual Event description, it says that it extracts "which elements have events attached to them". I can confirm this by running the bookmarklet and seeing all the colour highlights. I would like to extract this information without the fancy presentation so that I can play around with it into a script (Ruby/Python/Perl). In other words, I would like to get a list of the divs (and their info ideally) from Visual Event. Is there any way to do this without digging through the code on GitHub? Not to say that I'm not willing to do this, I was just wondering if there was an easier way.
Need to extract data from website and push to a program
16,578,621
0
0
225
0
python,web-crawler
Well you should probably start by learning the language in general it would make it alot easier to do but for the Web stuff you can use something called urllib and urllib2 these can open up the browser to get the data without actually opening the window also there are a few automated web browsers like selenium which actually opens the window there are many others you can look through on the internet but that's only the web browser automation then you have to actually obtain the information and data you want for this you need something like scrapy like you said or beautifulsoup these go through the source code and pick out the information you want since i don't exactly know what you want its kind of hard to explain but i hope this gives you somewhere to start but like i said you should probably learn basic python and that would help alot I hope this helps!!
0
0
1
0
2013-05-16T03:30:00.000
2
1.2
true
16,578,545
0
0
1
1
So i've been looking around trying to figure out how i could extract some specific data such as just the text, and push that data into a program that organizes the data. So if you took homedepot.com for example and wanted to extract from each item listed under "2x4 wood" and from each item you are needing to grab the name, the description, and the specifications and import that data into a piece of software that contains this data? So I guess that would be something like an automated data entry? From what I've researched I'd need to write a crawler program that is designed to search a specific term and then crawl each and every page that the result returns and grab the data that I need. However I have a bit of a problem: I don't really know any programming/scripting and am unsure where to start. I found something called Scrapy which is based off of Python. Is this what I want to use for the crawler? The next issue I have is the fact that I have no clue on how to now import the data gathered into the software? Any tips on where I should look to find this answer? I want to use this idea that I have to help me learn how to script.
how to invoke python script in jsp/servlet?
16,597,278
0
0
1,132
0
python,html,jsp,beautifulsoup
I assume you are talking about web scraping which is pulling information from other websites. You are not going to be able to do something like this in somebody's browser because it violates Javascript's same origin policy, AND there is no way a browser is going to let you download and execute a script on a client's computer. You could just write a python script to do this for you and execute it yourself on your machine however. Just be sure you are not violating web site's terms of service. EDIT: In that case I would recommend running the script on the command line, and then using the output of the program in the servlet to generate the responses you want.
0
0
0
0
2013-05-16T20:45:00.000
1
0
false
16,597,149
0
0
1
1
I am trying to invoke a python code for screen scraping (using Beautiful Soup) from my jsp servlet. Or it would also work if it can be directly invoked from the HTML. Looked through few threads but couldn't get any solution. What I want is to give the python program some arguments and want it to do some screen scrapping and return the result to jsp somehow.
Upload files via email in Django. General algorithm
16,599,805
1
1
99
0
python,django,email,django-email
Are you trying to read from a mailbox and write the information into the database? If so, then you want to: 1) Open a connection to the mail server using poplib or imaplib from the standard library 2) Retrieve messages from the server (again with poplib or imaplib) 3) Parse the messages with the email package from the standard library. From there, you can populate whatever stuff you want in your database, either using the Django ORM or not.
0
0
0
0
2013-05-16T21:23:00.000
1
1.2
true
16,597,739
0
0
1
1
How to implement something like this: If someone send email with file in attachment to [email protected], this file is added automatically to database. Please general algorithm how to do or suggest existing app
Azure - Running an http server on an VM
16,604,662
0
1
453
0
python,azure,azure-virtual-machine
Could it be that port 81 is blocked by firewall in Ubuntu?
0
1
0
0
2013-05-17T08:10:00.000
1
0
false
16,604,372
0
0
1
1
I have created a VM on Windows Azure with Ubuntu 12.04 running on it. I have two end-points End-point1 public port: 50348 private port: 22 End-point2 public port: 81 private port: 81 Now, I have a simple python HTTP server running on the Virtual Machine, which is listening on port 81. When I try to connect to localhost:81 from within the Virtual machine, I am able to connect, so I know that the server is up and running. Say, the DNS name assigned to my VM be blah-blah.cloudapp.net But, when I try to connect to http://blah-blah.cloudapp.net:81 from somewhere outside, I always get a Server Not Found error. So, how can I connect to my server?
Splice 2 PDF pages into one with Python
16,631,012
0
0
255
0
python,pdf-generation
Turns that Adobe's reader has a "Booklet" option in the printing options. Worked out nicely.
0
0
0
0
2013-05-19T01:12:00.000
1
0
false
16,630,537
0
0
1
1
I'm trying to write a novel and I am trying to print out my own book prototypes. I have a PDF of the book. Now I want to merge the pages so that I can print it double-sided, fold it in half, and staple it like a boss. The problem I need to solve is how to splice 2 pages together with a left and right side. I looked at PyPDF2 and its mergePage function, but it only superimposes one page onto another. The new generated page will be twice the width of the original pages, one page superimposed on the left, and one page superimposed on the right. Thank you for your time in looking at this!
web2py on a Virtual Machine
16,634,500
1
0
169
0
python,web2py
Can you share the error details? If you can't access the error dump file via the admin app, use some other tool to view the file under ...web2py/theapp/errors. The file format isn't easily readable, but the last few lines are usually pretty informative.
0
0
0
0
2013-05-19T02:26:00.000
1
0.197375
false
16,630,885
0
0
1
1
I have a web2py app I developed on my local machine. I tried to move the application to a Windows Server 2003 Virtual Machine but when I run it on the VM the app simply errors out on start up and when I click to see the error it prompts me for the admin password. When I enter it, the app errors again. There are no errors output on the console before, during, or closing the server. Is there something special I need to do for setup on a VM? Is this some kind of Apache problem? I believe the server only has http protocols active. I am using port 8080, since I think through version control the parameters_8000.py is a password I do not know. Thanks in advance.
Cannot scrape with beautifulsoup and urllib because of javascript variable
23,974,667
1
0
169
0
javascript,python,beautifulsoup,urllib2
I came back after a long time just to answer quickly my own question.. I found many solutions and tutorials on the web and most of them were suggesting using Selenium and xpath but this method was more complex than I needed.. So I ended up using Selenium ONLY for emulating the Browser (firefox in my case) and grabbing the html after the page was loaded completely. After that I was still using beautifoulsoup to parse the html code (whihc now would include the javascript data too).
0
0
1
0
2013-05-19T18:12:00.000
1
1.2
true
16,637,879
0
0
1
1
Unfortunately I am newbie with beautifulsoup and urllib so I might not even ask correctly what I need.. There is a website www.example.com I need to extract some data from this website which displays a random message. The problem is the message is displayed after the user presses a button, otherwise it shows a general message like "press the button to see the message". After searching stackoverflow I realised that probably there is NO way to change the variables by calling with my browser the url like this.. www.example.com/?showRandomMsg='true' In some threads I read that maybe I can do it with bookmarlets.. Is there anyway to use bookmarklets with beautifulsoup or urllib in order to access the website and make it display a random message? Thanks in advance! :D
Looking for techniques to debug external Python Flask Extensions
16,696,027
0
1
145
0
python,flask,flask-extensions,flask-security
I'm going to just answer my own question and say the best/easiest thing to do is just pull the extensions code into my project and modify as I need it. Seems like this will be the case with several Flask-extensions that involve more view/template code than pure infrastructure (like flask-security/flask-login, etc.)
0
0
0
0
2013-05-20T13:01:00.000
1
1.2
true
16,650,124
0
0
1
1
I'm using several third party flask-extensions (flask-login, flask-security, flask-principal, flask-mongoengine etc...the list is about 12 deep) in an application that is failing silently in production environment (currently AppFog Paas) I'm specifically trying to debug an issue with flask-security (I "think", but it could just as easily be flask-login, flask-mongoengine or any plugin in my authentication pipeline) since it has to do with logging in and redirecting the user to through the application. I notice several things about flask extensions that's making them a big quirky/difficult to work with: most don't have any debug logging in them some have partial support for configuring (like using your own templates) they install into the environment (I'm using virtualenv) as opposed to an application "plugins/extensions" directory I'm wondering if there's some guidance around: installing plugins into the project, so they can be quickly modified (maybe logging added) and then pushed into production without having to fork a github project and repackage it. Standard logging practices for 3rd party extensions, or anything that would help trace the code Any information/tips to help me debug my current problems Thanks.
Unit testing Cherrypy HTTPRedirect.
16,652,717
0
0
190
0
python,cherrypy,nose,nosetests
With python unit tests, you are basically testing the server. And the correct response from server is the redirect exception and not the redirected page itself. I would recommend you testing this behaviour in two steps: test if the first page/url throws correctly initialized (code, url) HTTPRedirect exception test contents of the second page (on which is being redirected) But of course, if you insist, you can resolve the redirect in Try/Except by yourself by inspecting the exception attributes and calling testing method on target url again.
0
0
1
1
2013-05-20T15:01:00.000
1
1.2
true
16,652,406
0
0
1
1
I’m writing a cherrypy application that needs to redirect to a particular page and I use HTTPRedirect(‘mynewurl’, status=303) to achieve this. This works inasmuch as the browser (Safari) redirects to ‘mynewurl’ without asking the user. However, when I attempt to unit test using nosetests with assertInBody(), I get a different result; assertInBody reports that ‘This resource can be found at mynewurl’ rather than the actual contents of ‘mynewurl’. My question is how can I get nosetests to behave in the same way as a Safari, that is, redirecting to a page without displaying an ‘ask’ message? Thanks Kevin
PHP cURL vs Python Scrapy?
16,659,313
3
0
1,634
0
php,python,scrapy
Scrapy is a framework. You can define pipelines and systematic ways of crawling a URL; cURL is simply boiler plate code to query a page or download files over a protocol like HTTP. If you are building an extensive scraping system or project, Scrapy is probably a better bet. Otherwise for hacky or one time things, cURL is hard to beat (or if you are constrained to PHP).
0
0
1
0
2013-05-20T18:13:00.000
1
0.53705
false
16,655,681
0
0
1
1
I've been into scraping websites data using Python Scrapy although I have a strong experience in PHP cURL. I don't know which is better for scraping data and manipulating the returned values and the speed and the memory usage. And what is (yield) function in Python Scrapy supposed to do?
How can I programmatically interact with a website that uses an AJAX JBoss RichTree component?
16,662,103
1
0
601
0
python,ajax,jboss,richfaces,screen-scraping
You need to make the AJAX calls from your client to the server and interpret the data. Interpreting the AJAX data is easier and less error-prone than scraping HTML any way. Although it can be a bit tricky to figure out the AJAX API if it isn't documented. A network sniffer tool like wireshark can be helpful there, there may also be useful plugins for your browser to do the same nowadays. I haven't needed to do that for years. :-)
0
0
1
0
2013-05-21T03:48:00.000
2
0.099668
false
16,661,801
0
0
1
1
I'm writing a python script to do some screen scraping of a public website. This is going fine, until I want to interact with an AJAX-implemented tree control. Evidently, there is a large amount of javascript controlling the AJAX requests. It seems that the tree control is a JBoss RichFaces RichTree component. How should I interact with this component programatically? Are there any tricks I should know about? Should I try an implement a subset of the RichFaces AJAX? Or would I be better served wrapping some code around an existing web-browser? If so, is there a python library that can help with this?
IntelliJ 12 Python - Issues with manage.py Tasks
16,706,964
4
2
1,462
0
python,intellij-idea,pycharm,manage.py
Okay, so apparently the culprit is the IntelliJ IDEA Project Creation Wizard. If you create a new project within PyCharms and choose Django Project as desired Project type, it just works. You don't have to configure anything else. To do this in IntelliJ IDEA, create a new Project, choose "Python Module" as type and check Django as technology. In the new project go to "File > Project Structure", navigate to "Facets", choose your Django Module on the right and set the "Settings:" option to point to the specific "settings.py" file. After this configuration, everything should work as smooth as in PyCharms. I consider this problem as a bug, as the Wizard creates the basic project, including a "settings.py" file, but doesn't add it in the project settings. Plus, you don't get any warning that such a strongly needed settings file is missing.
0
0
0
0
2013-05-21T07:46:00.000
1
1.2
true
16,664,714
0
0
1
1
I'm currently looking for a nifty Python/Django IDE and came across PyCharm from JetBrains which I tested for about a week now and I'm quite impressed by this piece of software. However, I've read that IntelliJ Ultimate with JetBrains own Python Plugin offers about the same Features as PyCharm itself, so I went ahead and gave it a try, but experienced some issues which I didn't have within PyCharms. In IntelliJ, the built in Feature 'Tools > "Run manage.py Task..."' works with most (e.g. runserver, startapp, syncdb, ...), but not with all commands: Almost all sql-related commands like "sql", "sqlall", "sqlclear", ... are shown as available commands, but raise a "No Applications" error message when entered. In PyCharm those commands works fine. Running the test suite via "test" opens a box where I have to choose the applications which I want to test. However, there is only one entry "[All Applications]" and running it causes several Exceptions to be thrown. Adding some new Applications to the "settings.py" file has no effect on "Run manage.py Task..." whereas in PyCharm it adds new commands to it. I've tried this for example with "django.contrib.gis" to enable "ogrinspect" All those issues lead to the assumption that IntelliJ somehow fails to recognize the installed django applications. Did I miss some configurations or settings in IntelliJ which are already set in PyCharm? To further explain what I did exactly: In IntelliJ I created a new project "Python Module" then enabled Django as desired technology. In PyCharm I just created a new project of type "Django Project". All following steps were exactly the same.
How to get google ID from email
16,673,012
2
1
1,883
0
python,google-app-engine,authentication,google-plus
First of all you should store the email property always in lowercase since the case is not relevant. Now if you also want to take into the account the dot or the plus symbols and being able to query on them, you should then store in another (hidden) property the stripped out version of the email and execute your queries on this one.
0
1
0
0
2013-05-21T14:43:00.000
2
1.2
true
16,672,846
0
0
1
1
I'm using google ID as the datastore id for my user objects. Sometimes I want to find a user by email. The gmail address can appear with dots or without, capital letters and other variations. How can I retrieve the user id from the given email?
Executing a Python Script when Web Page is loaded
16,698,568
0
0
4,778
0
javascript,python,html,web
I had to do this too. I had a python script(which gets me data from another website) which gets executed when you click on a button. I used Ruby on Rails for my client side code. I embedded the script file in my ruby controller which then gets called by my form and hence it gets executed. eg: cmd = " python getData.py " exec( cmd )
0
0
0
0
2013-05-22T17:36:00.000
2
0
false
16,698,220
0
0
1
1
I'm trying to have it so that when my web page is loaded, a python script is executed. The website is run on an apache server and the script is in the same directory as the index.html (it's a very small project). Is there anyway I can do this? I'm not trying to output the data from the python file to the webpage, nor am I trying to affect anything client-side, I simply want the python script to execute and do it's thing whenever the web page is loaded. Is there some sort of javascript function that I can use? I've searched around but really haven't found anything similar. Thanks!
Google App Engine import NLTK error
16,700,974
0
0
423
0
google-app-engine,python-2.7,nltk
Where do you have nltk installed? GAE libraries need to be available in your app folder. If you have nltk elsewhere in your pythonpath it won't work.
0
1
0
0
2013-05-22T17:38:00.000
1
0
false
16,698,260
0
0
1
1
I am trying to import NLTK library in Google App Engine it gives error, I created another module "testx.py" and this module works without error but I dont know why NLTK does not work. My code nltk_test.py import webapp2 import path_changer import testx import nltk class MainPage(webapp2.RequestHandler): def get(self): #self.response.headers['Content-Type'] = 'text/plain' self.response.write("TEST") class nltkTestPage(webapp2.RequestHandler): def get(self): text = nltk.word_tokenize("And now for something completely different") self.response.write(testx.test("Hellooooo")) application = webapp2.WSGIApplication([ ('/', MainPage), ('/nltk', nltkTestPage), ], debug=True) testx.py code def test(txt): return len(txt) path_changer.py code import os import sys sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'nltk')) sys.path.insert(1, os.path.join(os.path.dirname(__file__), 'new')) app.yaml application: nltkforappengine version: 0-1 runtime: python27 api_version: 1 threadsafe: true handlers: - url: /.* script: nltk_test.application - url: /nltk.* script: nltk_test.application libraries: - name: numpy version: "1.6.1" This code works fine When I comment the import nltk and nltk related code, I think NLTK is not imported, please help me to sort out this problem, thanks
Django "Table already exists" on testing
50,297,908
0
1
2,226
0
python,django,python-2.7
you should use python manage.py migrate app_name rather than python manage.py migrate.Because you had used it before
0
0
0
0
2013-05-22T17:40:00.000
2
0
false
16,698,296
0
0
1
1
I've tried to solve the following issue: I'm running python manage.py test to test my application. After creating a new test_app database, I'm getting DatabaseError: (1050, "Table 'auth_group' already exists") I haven't installed South (it's not on the INSTALLED_APPS list), how do I solve this?
django select app(s) for syncdb
34,055,679
0
0
2,970
0
python,django,django-syncdb,syncdb,django-manage.py
This seems to work - python manage.py syncdb --database=NEW_APP_DB
0
0
0
0
2013-05-22T19:56:00.000
4
0
false
16,700,526
0
0
1
1
First of all: please don't ask me: "Why would you need this?". Now the question itself: I have several applications installed in INSTALLED_APPS. Database is now empty and I want to synchronise only some of apps. What's the simplest way to do this? I know I can write my custom management command based on syncdb. But it's a shame syncdb is designed in such a way that I would have to copy/paste a large chunk of code, changing only one line. This is a reason I want to explore other possibilities.
optimizing google protocol buffer
19,603,923
0
2
1,004
0
java,python,protocol-buffers
Unfortunately the Python protobuf deserialization is just pretty slow (as of 2013) compared to the other languages.
0
1
0
0
2013-05-22T20:01:00.000
2
0
false
16,700,600
0
0
1
1
I'm new to google's protocol buffers and looking into some insight. I have a large object that is serialized in java which I am de-serializing in python. The upstream tells me that the file is serialized in about 4 to 5 seconds. Where it takes me 37 seconds to de-serialize. Any ideas on why it is such a huge difference besides hardware? are there ways I can speed up the de-serialization? Does Java perform better for this? I'm simply grabbing a serialized data file and using ParseFromString. Thanks UPDATE:- So just got back to this after a while and tried to deserialize the file using java. It took 4 seconds to deserialize a bigger file (56 m). Now this solves my problem with the performance however, I really am confused about the huge difference between the python and java, any insights?
Using Scrapy DjangoItem with Django best way
16,755,838
2
3
896
0
django,python-2.7,scrapy
I generally put my scrapy project somewhere inside my Django project root folder. Just remember you will need to make sure both projects are in the python path. This is easy to do if you are using virtualenv properly. Aside from that as long as you can import your Django models from Scrapy i think everything else in the Scrapy docs is very clear. When you import your Django model, the Django settings are set up at that point, this means your database connection etc should all be working fine as long as they are already working in Django. The only real trick is getting the python path set up properly (which is probably a topic for another questions).
0
0
0
0
2013-05-22T20:28:00.000
1
1.2
true
16,701,027
0
0
1
1
I am am new to Django / Scrapy and well to programming in general. I am trying to make a Django site to help me learn. What I want to do is Scrape product information from different sites and store them in my postgres database using DjangoItem from Scrapy. I have read all the docs from both Scrapy and Django. I have searched here and other sites for a couple days and just couldn't find exactly what I was looking for that made the light bulb go off. Anyway, my question is, what is the standard for deploying Scrapy and Django together. Ideally I would like to scrape 5-10 different sites and store their information in my database. Scrapy's docs are a little short on information on the best way to implement DjangoItem. 1) Should the Scrapy project be inside my Django app, at the root level of my Django project or outside all together. 2) Other than setting DjangoItem to my Django model, do I need to change any other settings? Thanks Brian
How can I load data files in a Jython module?
16,947,188
0
4
739
0
java,python,jython
Maybe I'm just missing the point, but can't you use getResourceAsStream() on a Java class?
0
0
0
0
2013-05-22T21:19:00.000
3
0
false
16,701,764
1
0
1
1
I have some Jython modules that I'm trying to make work from within a JAR. Everything is set up fine except that some modules expect to open files from the filesystem that are located in the same directory as the Python script itself. This doesn't work anymore because those files are now bundled into the JAR. Basically I want to know if there's an equivalent of Class.getResourceAsStream() that I can use from within the Python code to load these data files. I tried to use '__pyclasspath__/path/to/module/data.txt' but it didn't exist.
What's the Google App Engine equivalent of ASP.NET's Server.Transfer?
16,705,889
0
0
210
0
python,google-app-engine,webapp2
Usually, you just have to call the corresponding method. For being more specific... Which flavour of AppEngine are you using? Java, Python, Go... Php?
0
1
0
0
2013-05-23T04:29:00.000
3
0
false
16,705,684
0
0
1
1
Server.Transfer is sort of like a Redirect except instead of requesting the browser to do another page fetch, it triggers an internal request that makes the request handler "go to" another request handler. Is there a Python equivalent to this in Google App Engine? Edit: webapp2
Viewing a django-cms page via the slug
16,723,428
0
0
581
0
python,django,django-cms
After digging through the code, I discovered that django-cms doesn't actually expose pages via their slug unless they're created UNDER a home page. The code that looks up a page via their slug looks in the cms_title table, and it stores '' for the slug for any page that's not a child. Very unintuitive, but after I re-created the page under a "Home" page, I could then access it via the /about/ page.
0
0
0
0
2013-05-23T18:04:00.000
2
1.2
true
16,720,883
0
0
1
2
How do you view a published django-cms page using a path that incorporates the slug? I installed django-cms without error, and I can view the default cms homepage just fine. I created and published a simple "About" page with the slug "about", but when I visit http://localhost:8000/about/ I get a 404 error. I can see the page if I use the "View on site" button, but that takes me to http://localhost:8000/?preview=1&language=en, not the real published path. What am I doing wrong?
Viewing a django-cms page via the slug
16,721,162
0
0
581
0
python,django,django-cms
you won't get access until you check the published in cms page list view in admin. View on site help with a preview before page is published.
0
0
0
0
2013-05-23T18:04:00.000
2
0
false
16,720,883
0
0
1
2
How do you view a published django-cms page using a path that incorporates the slug? I installed django-cms without error, and I can view the default cms homepage just fine. I created and published a simple "About" page with the slug "about", but when I visit http://localhost:8000/about/ I get a 404 error. I can see the page if I use the "View on site" button, but that takes me to http://localhost:8000/?preview=1&language=en, not the real published path. What am I doing wrong?
Does GoogleAppEngine(Python SDK) disturb GoogleAppEngine(PHP SDK)?
17,073,068
0
0
209
0
php,python,google-app-engine
Thanks very much, hakre. I know what happened. The problem is I also have a python version Google-App-Engine.Thus, I need to specify the "development server" to GAE-PHP-SDK and it works well now!! Thanks again, I think I will deliver such a kindness to others in the future. – moshaholo May 26 at 12:16 Can any one tell me how to change or specify the development server to GAE-PHP-SDK. I just started using it and don't know too much about this stuff. P.S Sorry for posting as answer. Wasn't able to see a reply option on top.
0
1
0
0
2013-05-24T14:25:00.000
1
0
false
16,737,308
0
0
1
1
The new launched GoodleAppEngine(PHP Version) does not work on my computer. Every time I type in "localhost:8080", the running server returns me a "GET / HTTP/1.1" 500". And it give me a fatal ERROR: Fatal error: require_once(): Failed opening required 'google/appengine/runtime/ApiProxy.php' (include_path='/Users/xxxxx/Job_work/helloworld:/usr/local/bin/php/sdk') in /Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/php/setup.php Does that mean my Python GAE disturbs my PHP version SDK?
Beautiful Soup "not supported" Google App Engine
16,737,623
0
0
1,031
0
python,google-app-engine,beautifulsoup
It seems uploading the whole directory where the bs4 module resides in to the GAE app folder would work.
0
1
0
0
2013-05-24T14:29:00.000
2
0
false
16,737,386
0
0
1
1
I am working in python on a GAE app. Beautiful soup, which the app uses, works fine on my dev server locally. When I try and upload it to google's servers however, I get the following error: "Error parsing yaml file: the library "bs4" is not supported". I am not sure how to fix this. Does anyone have any idea? Thank you. File Structure: app.yaml main.py static(DIR) templates(DIR) bs4(DIR)
How to add multitouch support for ChromeEmbeddedFramework browser on windows 8?
16,913,113
0
1
652
0
python,windows-8,multi-touch,chromium-embedded
The problem was fixed by using CEF3 rather than CEF1
0
0
1
0
2013-05-24T14:58:00.000
1
1.2
true
16,737,962
0
0
1
1
I 've develooped a basic custom browser with CEF (Chromium Embedded Framework) Python . This browser is meant to run into an interactive kiosk with windows 8. It has a multi-touch screen for all user interactions. If I run Google Chrome on the machine, the multi-touch gestures (scroll and virtual keyboard) are supported. Unfortunately my CEF browser doesn't have detect any multi-touch event. How can I fix it? ANy pointer is welcomed.
Unable to write code in pydev for django project
16,835,207
0
7
136
0
python,django
try to restart development server
0
0
0
0
2013-05-26T12:54:00.000
3
0
false
16,759,430
0
0
1
1
I am just the beginner in django. I use pydev eclipse in windows 8. First I write a "Hello World " program and display the string in browser but when I changed the code the change in the output is not appear. Whatever I change nothing change in output. But when I close the eclipse and shutdown the computer and restart then I change the program and run it. The code output is changed. But now further to change my program I again need to restart my computer. What is happening ?
Concurrency doubts in Django
16,771,514
4
3
1,239
0
python,django,concurrency
Its webserver specific. If you configure it to run in different process, request will be handled in new process. If you configure to have threads it will be in threads. Yes. Imagine case when, user1 is viewing/editing a object A (retrieved from DB). user2 deletes that object. And then user1 tries to save it. You need to handle such cases explicitly in your code. Most likely the issues will be related to DB. So you can use transactions to help in some cases. In some other cases, you can define strategy. E.g the case mentioned above, when user1 tries to save the object, and its not there in db you can just create one.
0
0
0
0
2013-05-27T10:42:00.000
2
1.2
true
16,771,391
0
0
1
1
I'm developing a website with Django 1.5.1 and I have two doubts regarding concurrence. Now I'm runing on the development server. When multiple users access the website at the same time, by default, does Django run each request in a different execution thread? Or must it be configured in the webserver e.g. Apache? Will I experience issues if more than a user is modifying the same object concurrently? If so, how do you solve this problem? Using locks? Thanks for your help!
A way to optimize reading from a datastore which updates once a day
16,775,062
1
1
53
1
python,django,google-app-engine
Your total amout of data is very small and looks like a dict. Why not save it (this object) as a single entry in the database or the blobstore and you can cache this entry.
0
1
0
0
2013-05-27T13:08:00.000
1
1.2
true
16,773,961
0
0
1
1
I am running my Django site on appengine. In the datastore, there is an entity kind / table X which is only updated once every 24 hours. X has around 15K entries and each entry is of form ("unique string of length <20", integer). In some context, a user request involves fetching an average of 200 entries from X, which is quite costly if done individually. What is an efficient way I can adopt in this situation? Here are some ways I thought about, but have some doubts in them due to inexperience Using the Batch query supported by db.get() where a list of keys may be passed as argument and the get() will try to fetch them all in one walk. This will reduce the time quite significantly, but still there will be noticeable overhead and cost. Also, I am using Django models and have no idea about how to relate these two. Manually copying the whole database into memory (like storing it in a map) after each update job which occurs every 24 hour. This will work really well and also save me lots of datastore reads but I have other doubts. Will it remain persistent across instances? What other factors do I need to be aware of which might interfere? This or something like this seems perfect for my situation. The above are just what I could come up with in first thought. There must be ways I am unaware/missing. Thanks.
Counter in OpenErp - Python
16,789,456
1
0
171
0
python,orm,module,openerp
there is a model called 'ir.sequence'. You can create a sequence type and sequence for your model and then just by calling the code of the sequence you will be able to generate new sequences
0
0
0
0
2013-05-28T05:09:00.000
1
1.2
true
16,784,271
0
0
1
1
I need a field which adds a counter to a specific item i add in the product section of a custom module. Like an automatic number generated by the system, for let's say Internal Reference, so every time i save a new product this field will create a number for it in this field, like IN0001, IN0002, IN0003, etc... I've looked into the internet, searching for some example on how to achieve this in OpenErp but no luck. Is there any module or already made function in OpenErp which has this behavior? Thanks in advance
How to store sensitive information that needs to be shared across different users?
16,795,862
2
1
2,061
0
python,django,django-models,security
Storing passwords using a reversible encryption is about as safe as plain text. Use OAuth or something similar, or prepare for serious troubles when (not "if" - "when") someone will hack your database.
0
0
0
0
2013-05-28T14:46:00.000
4
0.099668
false
16,795,018
0
0
1
1
I have to store some sensitive information in my database using Django. I have a Client model and each client has a bunch of SocialAccounts (twitter, fb, etc) with an URL, client and password. Considering ALL users that belong to the group "Administrator" should be able to see the passwords. What's a safe way to store those passwords in the database?
web2py and d3.js compatibility
16,812,347
1
1
358
0
python,d3.js,web2py
No, there should not be any compatibility issues. web2py is primarily a server-side framework, and D3 is all client-side. They are completely independent. web2py does provide some client-side scaffolding, but it is optional and won't interfere with D3 anyway.
0
0
0
0
2013-05-29T07:54:00.000
1
1.2
true
16,808,328
0
0
1
1
I'm a relatively unexperienced developer starting on a new project to expose some pre-existing Python analytical libraries' functions in a web application through javascript visualization library d3.js. I've explored the web2py framework for Python, and would just like to ask a simple question: Are there any compatibility issues I should be aware of between web2py and d3.js? Thanks a lot!
Scrapy ImportError
16,818,251
2
3
907
0
python,twisted,scrapy,importerror
Verify that you have zope.interface 4.0.5 installed on the same version of Python as you are using to run scrapy. Most likely you have more than one version of Python installed and scrapy is using a different version than you expect.
0
0
0
0
2013-05-29T14:41:00.000
1
0.379949
false
16,816,929
1
0
1
1
When I try to run Scrapy I get an ImportError stating that Twisted requires zope.interface 3.6.0 or later. The version of zope.interface I have is 4.0.5, so I'm perplexed by this error. I've read other suggestions recommending installing zope.interface via pip, but that did not work. I'd like some help figuring out how Twisted or Scrapy is getting the zope.interface version number, or if there's a work-around that I can employ to get this to work?
Android to Playstation and other consoles
16,818,550
0
1
150
0
java,android,python,bluetooth,playstation
Im pretty sure you need an emulator for this. Correct me if Im wrong.
0
0
0
1
2013-05-29T15:17:00.000
2
0
false
16,817,777
0
0
1
1
i am trying to find if it is possible to send a message over Bluetooth to consoles like playstation 3 to make it turn on or off? since it is possible to be done from controllers. I been reading around about it. but was wondering if there is any information or exapmles that could help. as all i could find was python code which i am not really a pro in. Any information will be much appreciated.
Why won't python webassets pyscss regenerate css from scss files in debug mode?
16,826,275
5
3
850
0
python,css,debugging,sass,webassets
Figured it out. Webassets does not pick up on changes to scss files that are included in other scss files using @import. The only solution is to always make a change to the including scss file if you make a change to the included one.
0
0
0
0
2013-05-30T00:51:00.000
2
0.462117
false
16,826,233
0
0
1
1
I'm using the pyscss compiler in the python webassets library with webassets debug configs all set to true. But when I make changes to an scss file and reload the page that includes the generated css file, I see that the css file has not be regenerated and does not include my changes. Why is this happening?
Can Not execute Python .py file using RobotFramework like Javascript
16,847,883
1
1
635
0
python,robotframework
The Execute Javascript extension isn't a part of RobotFramework, it's something added by the Selenium integration, it would therefore follow that you can't use Selenium to execute a .py file. That said, RobotFramework is written in Python and can obviously be extended with a Python script. Can you clear up what you're actually trying to achieve here though? My concern is that if you're using a .py file in your test state to validate your code, isn't that introducing an uncertainty that means that what you're testing is not the same as the code that gets executed when you release your project? A bit more detail would help a lot here!
0
0
1
0
2013-05-30T00:59:00.000
1
0.197375
false
16,826,304
0
0
1
1
Has anyone found a method for executing their .py files from the Robot Framework like you can for JS? RobotFramework: Executes the given JavaScript code. code may contain multiple statements and the return value of last statement is returned by this keyword. code may be divided into multiple cells in the test data. In that case, the parts are catenated together without adding spaces. If code is an absolute path to an existing file, the JavaScript to execute will be read from that file. Forward slashes work as a path separator on all operating systems. The functionality to read the code from a file was added in SeleniumLibrary 2.5. Note that, by default, the code will be executed in the context of the Selenium object itself, so this will refer to the Selenium object. Use window to refer to the window of your application, e.g. window.document.getElementById('foo'). Example: Execute JavaScript window.my_js_function('arg1', 'arg2') Execute JavaScript ${CURDIR}/js_to_execute.js It's bs that I can't run my .py files this way...
Does a Django site with a Tastypie interface need two codebases?
16,846,436
3
2
134
0
python,django,web-applications
For this to be meaningful, you likely need to connect to the same database Why would you need two codebases? You have two copies of a single codebase.
0
0
0
0
2013-05-30T21:45:00.000
4
0.148885
false
16,846,391
0
0
1
3
I have a Django project with several apps. My project is now getting to the point it needs an API. I'm planning to have the API on a different server using tastypie. However, the API will use the same models as the website. So far I see my only option is as follows... Copy the apps to the server which means I have two apps using the same models and now have to maintain two code bases --- bad! So, how do other handle this? What options do I have? Can my models be shared somehow?
Does a Django site with a Tastypie interface need two codebases?
16,846,450
1
2
134
0
python,django,web-applications
Why don't you run the api on the same server on a different port? that will save you a lot of problems to start with. Sharing database connections cross servers will likely require you to think about security, a lot. Also if you are reusing the same apps in different projects you might want to package and version your apps for comfort. Think about the real problem you are trying to solve and always keep that in mind. There are plenty of solutions for every problem, finding the right one makes a difference.
0
0
0
0
2013-05-30T21:45:00.000
4
0.049958
false
16,846,391
0
0
1
3
I have a Django project with several apps. My project is now getting to the point it needs an API. I'm planning to have the API on a different server using tastypie. However, the API will use the same models as the website. So far I see my only option is as follows... Copy the apps to the server which means I have two apps using the same models and now have to maintain two code bases --- bad! So, how do other handle this? What options do I have? Can my models be shared somehow?
Does a Django site with a Tastypie interface need two codebases?
16,855,093
2
2
134
0
python,django,web-applications
I wouldn't recommend splitting your project like this. Every time you edit a model you have to edit it on both immediately or risk things getting out of sync. This will get very very painful, instead; Is the server the bottleneck? Split site and api machines (but using the same models.py) and share the connection to the DB somewhere. Is the DB the bottleneck? Scale up the DB to a faster machine / cluster and use the same site for to supply web and api. Either way, One codebase, One set of models, One DB!
0
0
0
0
2013-05-30T21:45:00.000
4
1.2
true
16,846,391
0
0
1
3
I have a Django project with several apps. My project is now getting to the point it needs an API. I'm planning to have the API on a different server using tastypie. However, the API will use the same models as the website. So far I see my only option is as follows... Copy the apps to the server which means I have two apps using the same models and now have to maintain two code bases --- bad! So, how do other handle this? What options do I have? Can my models be shared somehow?
Test if string is valid key prior to memcache.get()
16,866,096
0
1
581
0
python,google-app-engine,python-memcached
Any object is a valid key, provided that the object can be serialized using pickle. If pickle.dumps(key) succeeds, then you shouldn't get a BadKeyError.
0
1
0
0
2013-05-31T14:27:00.000
3
0
false
16,859,674
0
0
1
2
Is there a function in Google App Engine to test if a string is valid 'string key' prior to calling memcache.get(key) without using db.get() or db.get_by_key_name() first? In my case the key is being passed from the user's get request: obj = memcache.get(self.request.get("obj")) Somehow I'd like to know if that string is a valid key string without calling the db first, which would defeat the purpose of using memcache.
Test if string is valid key prior to memcache.get()
16,867,410
1
1
581
0
python,google-app-engine,python-memcached
A db module key sent to a client should pass through str(the_key) which gives you an URL safe encoded key. Your templating environment etc.. will do this for you just by rendering the key into a template. On passing the key back from a client, you should recreate the key with key = db.Key(encoded=self.request.get("obj")) At this point it could fail with something like BadKeyError: Invalid string key "thebadkeystring"=. If not you have a valid key obj = memcache.get(self.request.get("obj")) won't actually raise BadKeyError because at that point you are just working with a string, and you just get None returned or a value. So at that point all you know is you have a key missing. However you need to use the memcache.get(self.request.get("obj")) to get the object from memcache, as a db.Key instance is not a valid memcache key. So you will be constructing a key to validate the key string at this point. Of course if the memcache get fails then you can use the just created key to fetch the object with db.get(key)
0
1
0
0
2013-05-31T14:27:00.000
3
0.066568
false
16,859,674
0
0
1
2
Is there a function in Google App Engine to test if a string is valid 'string key' prior to calling memcache.get(key) without using db.get() or db.get_by_key_name() first? In my case the key is being passed from the user's get request: obj = memcache.get(self.request.get("obj")) Somehow I'd like to know if that string is a valid key string without calling the db first, which would defeat the purpose of using memcache.
threading programming in python
16,891,362
1
2
2,730
0
python,flask
I have not threading solution: I'm using celery for hard operations: send email, fetch url, create many database records, periodic tasks. + you can use flask application and celery instances on different servers - you need backend (rabbitmq, redis, mongodb and etc.)
0
0
0
0
2013-06-01T08:44:00.000
3
0.066568
false
16,870,858
1
0
1
1
Recently I've been practicing to build a website with flask. Now i encounter a problem.There is a function which to achieve registration. The code like this: def register(): ... some judgment ... if true: sendmail() return redirect(url_for('onepage')) My question is : When preforming sendmail(), it needs much time. So the users have to wait for a moment to get "onepage", about 4-5s. This will bring a bad experience. I know that using threading can let these two functions independently of each other, but I have learnt programming for a very short time so I have no experience in threading programming, Could anybody provide some ideas or code examples for me at this problem?
Does using a virtual environment influence the performance of a web app?
16,871,438
12
8
2,134
0
python,django,virtualenv
Nope, it doesnt infuence the performance. Basically all what it do is changing python path to the virtualenvs ones. So there shouldn`t be any difference with performance.
0
0
0
0
2013-06-01T09:33:00.000
1
1.2
true
16,871,254
1
0
1
1
I have a django app up and running. I never encountered any performance problems, though the app is hosted on a shared hosting platform. The provider asked my recently to use python's virtualenv. Since then the performance has been really bad, though I can't detect the change in CPU usage or any other statistic. So my question is: does using a virtual environment influence the performance? If yes, how?
How to overwrite the default email message for user account activation in django-userna?
16,879,697
1
0
173
0
python,django
You don't need to copy whole django-userena module in you project directory. You only need to copy "emails" folder from userena/templates/userena/ into you project template directory with same directory structure. For Example : you_project_dir/templates/userena/emails After that just change activation_email_message.txt file content in emails folder of your project template directory.
0
0
0
0
2013-06-02T02:45:00.000
1
1.2
true
16,879,278
0
0
1
1
I want to replace the default django-userna email message for user account activation with one that is website specific. I've thought of some ways to do this like copying the entire installed django-userna module into a project specific app and replacing the default message stored in the module, but, all of my solutions have felt really hackish. Thank you!
Efficient way to check whether a page changed (while storing as little info as possible)?
16,890,397
2
0
89
0
python,hash,web-scraping
You can keep track of the date of the last version you got and use the If-Modified-Since header in your request. However, some resources ignore that header. (In general it's difficult to handle it for dynamically-generated content.) In that case you'll have to fall back to less efficient method.
0
0
1
0
2013-06-03T04:54:00.000
2
0.197375
false
16,890,209
0
0
1
2
I have some webpages where I'm collecting data over time. I don't care about the content itself, just whether the page has changed. Currently, I use Python's requests.get to fetch a page, hash the page (md5), and store that hash value to compare in the future. Is there a computationally cheaper or smaller-storage strategy for this? Things work now; I just wanted to check if there's a better/cheaper way. :)
Efficient way to check whether a page changed (while storing as little info as possible)?
16,890,487
0
0
89
0
python,hash,web-scraping
A hash would be the most trustable source of change detection. I would use CRC32. It's only 32 bits as opposed to 128bits for md5. Also, even in browser Javascript it can be very fast. I have personal experience in improving the speed for a JS implementation of CRC32 for very large datasets.
0
0
1
0
2013-06-03T04:54:00.000
2
1.2
true
16,890,209
0
0
1
2
I have some webpages where I'm collecting data over time. I don't care about the content itself, just whether the page has changed. Currently, I use Python's requests.get to fetch a page, hash the page (md5), and store that hash value to compare in the future. Is there a computationally cheaper or smaller-storage strategy for this? Things work now; I just wanted to check if there's a better/cheaper way. :)
What is the best way to store large session data in web applications?
16,898,841
0
1
758
0
javascript,python,html,web-applications,flask
Yuo should try localstorage .
0
0
0
0
2013-06-03T13:57:00.000
3
0
false
16,898,520
0
0
1
1
I am building a website that does not require people to login, but still needs large session data. Example: a person uploads a 0.5 MB file. I want to able to manipulate this this from now and then. Where should I store it? I would prefer something like a cookie system, but obviously this is too small. Redis seems like an opportunity, but I was hoping for something simpler. I'm using Python flask. Thanks in advance.
Can a django app have more than one views.py?
16,899,786
0
3
1,066
0
python,django,django-views
You can totally do that, it is only a convention to use views.py. Now, the question is: do you really need to create a new file to put your views inside ? Shouldn't these regrouped in a new application ? Think of an other person reviewing your code: would the reason of the separation be crystal clear to him ?
0
0
0
0
2013-06-03T14:51:00.000
3
0
false
16,899,597
0
0
1
1
I have just started learning Django. I was wondering if Django app can have more than one views file? Let's say, I have two separate classes. Should I keep them in one views file or can I make two views files? Thanks in advance!
Django return .html file directly without parsing for template tags at all
16,900,507
4
2
2,717
0
python,django,javascriptmvc
If you don't want to render a template, simply don't render it. Django won't render anything unless you specifically call template.render or one of the shortcuts. If you just want to return an HTML file, you could just open it as a normal file, read it, then return the content as the response. Alternatively, as suggested in the comment, you can serve it as a static file.
0
0
0
0
2013-06-03T15:20:00.000
1
0.664037
false
16,900,215
0
0
1
1
I'm writing a single view Javascript application with a Django backend that only needs to return the initial index.html and all other templates come from a CDN. My problem is that this first index.html file is parsing out some of my "{{}}" handlebars which I wanted to leave for the JS library to interpret. I DO NOT want to use 'verbatim' or 'raw' or any additional tags because I don't want any django specific stuff in my static template files. A possible alternative answer to this would be desmonstrating how to to make your inital index HTML response also come from the CDN but I didn't think that was possible.
How to shutdown all dynamic instances in Google App Engine without re-deploying the app?
23,557,544
1
1
1,179
0
java,python,google-app-engine,load-testing
We had a similar problem - I found that disabling the app in Application Settings and then re-enabling it terminated all 88 instances we had running, without any other adverse effects.
0
1
0
0
2013-06-03T20:29:00.000
2
0.099668
false
16,905,303
0
0
1
2
We are running multiple load tests every day against one of our GAE apps. We use the following pattern: Start a load test and let it run for a few hours. Look at graphs. Optionally deploy a new version of our app with performance improvements. Go back to 1. Each load test creates a couple hundred front end instances. We would like to terminate those between individual load tests even when we are not deploying a new version of our app. Is there a way to terminate all dynamic instances? Right now we either have to deploy a new version or terminate all instances by hand.
How to shutdown all dynamic instances in Google App Engine without re-deploying the app?
16,909,149
0
1
1,179
0
java,python,google-app-engine,load-testing
Maybe have them all periodically probe the datastore (or memcache) for a kill value?
0
1
0
0
2013-06-03T20:29:00.000
2
0
false
16,905,303
0
0
1
2
We are running multiple load tests every day against one of our GAE apps. We use the following pattern: Start a load test and let it run for a few hours. Look at graphs. Optionally deploy a new version of our app with performance improvements. Go back to 1. Each load test creates a couple hundred front end instances. We would like to terminate those between individual load tests even when we are not deploying a new version of our app. Is there a way to terminate all dynamic instances? Right now we either have to deploy a new version or terminate all instances by hand.
Django reusable application with linked FK?
16,914,965
1
3
115
0
python,django
Often it's ok to import models between apps. This just creates a dependency, something many apps have. Of course it's more flexible to have your app be independently pluggable, but the important thing is that you document any dependencies for anyone else trying to use your app(s). If you really want your app to be pluggable, consider reorganizing your app. Simplicity is good, but going over-overboard and insisting on strict, literal adherence to principles can get in the way of functionality. (Without specific details of your app, this is just speculation, but since all the apps you describe revolve around Contacts, it seems like they could simply be repackaged into the same app with unsubscribe as boolean field in contacts and a view to set the attribute. And depending on what exactly you want to do with Email, something similar)
0
0
0
0
2013-06-04T08:34:00.000
2
0.099668
false
16,913,178
0
0
1
1
I have the following scenario. I have an existing application called ‘Contacts’ with it's model I have number and name. I want to create a new application called ‘unsubscribe’ and I want to make it reusable. This is my issue: In the new app called unsubscribe it's model will need a foreign key relationg to the contact number. This now means that it is now tied to ‘contacts’ and I cannot use it for say my email app. How does Django deal with this from a reusable point of view?
How do I debug my web.py project in Eclipse?
16,931,564
0
0
337
0
python,eclipse,debugging,web.py
It's actually very easily, and applies to most projects. 1) Go to your "Debug Configurations" window (under "Debug As"). 2) Under "Python Run", add a new configuration. 3) Enter the name of the project. 4) Under "Main Module", click on "Browse" and select the script that you've been starting from the command-line. 5) Save. Dustin
0
0
0
0
2013-06-05T04:27:00.000
1
1.2
true
16,931,563
0
0
1
1
I have my web.py project open in Eclipse, but how can I: 1) Start my project from within Eclipse (and not the console)? 2) Debug my project from within Eclipse (breakpoints, etc..)? There's no readily-accessible information about this.
Should South be used to rename files and/or instances of a keyword in code?
16,932,331
1
0
70
0
python,django,django-south
In a scale of one to madness, I think it's a terrible idea. Your version control system would commit suicide as soon as you tried to update the code further since your VCS would only have the old values while your migration would change the existing files. I think it's reasonable to have the migration rename uploaded files, but not source files. Why treat this any different from any other change to your source? Why put this particular source change in a migration? This is madness :)
0
0
0
0
2013-06-05T04:47:00.000
1
1.2
true
16,931,757
0
0
1
1
I recently found out that, during my coding, I inadvertently named one of the Models of a Django app as a subtly mispelled version of an English word. This was not too long ago, but now there are exactly 300 occurrences of the same mispelled word across models, views, tests and my old grandmother's last will and testament. I'll surely use South to handle the changes in the models, but what about filenames and other changes in the code? Should I have the forward() migration change everything, including finding-replacing all instances of the word and renaming a couple of files? In a scale of one to madness, how bad is this idea?
How to View My Postgres DB Schema from Command Line
16,942,831
3
2
3,348
1
python,django,postgresql,heroku,django-south
From the command line you should be able to do heroku pg:psql to connect directly via PSQL to your database and from in there \dt will show you your tables and \d <tablename> will show you your table schema.
0
0
0
0
2013-06-05T14:15:00.000
3
1.2
true
16,942,317
0
0
1
1
So I have my Django app running and I just added South. I performed some migrations which worked fine locally, but I am seeing some database errors on my Heroku version. I'd like to view the current schema for my database both locally and on Heroku so I can compare and see exactly what is different. Is there an easy way to do this from the command line, or a better way to debug this?
Dropzonejs - Doesn't show progress bar / complete status and doesnt hide fallback form
17,276,082
0
1
1,443
0
python,django,dropzone.js
This sounds as if you didn't include the CSS files that come along with Dropzone. Or you didn't add the dropzone or dropzone-previews class to your form.
0
0
1
0
2013-06-05T17:53:00.000
2
0
false
16,946,659
0
0
1
1
I'm using latest dropzone.js, version 3.2.0. I downloaded the folder and have all files needed. Using latest Chrome. When i drop a file, dropzone sends it to the server, and i successfully save it, but nothing visual happens on the front end. I guess i'm missing something trivial. How to make dropzone show upload progress animation? Another issue i have is that dropzone doesnt hide the div.fallback that contains fallback form. I thought those features supposed to work automatically.
Interpretation of Java or Ruby neccessary with every access?
16,951,499
1
0
38
0
java,php,javascript,python,ruby
No. Bytecode caches are available for PHP (e.g. Zend Accelerator); Java is compiled to bytecode. Can't speak for Python.
0
0
0
0
2013-06-05T23:28:00.000
2
0.099668
false
16,951,484
0
0
1
2
JavaScript on the server can be interpreted to mashine code using Google's V8 Javascript Engine. But PHP and Ruby and Python and Java all have to run through an interpreter every time they're accessed and it interpretation will be less fast. Is that true? I read this in an article about Google's V8 Javascript Engine.
Interpretation of Java or Ruby neccessary with every access?
16,951,649
1
0
38
0
java,php,javascript,python,ruby
Java is compiled to bytecode, and then (usually) compiled to machine code using a Just-In-Time (JIT) compiler. Java servers don't launch a new process for every request (most just launch a new thread), so the cost of the JIT compile is amortized across the entire lifetime of your server. In practice, this means that Java servers can handle requests at speeds comparable to C or C++ (modulo the different performance profile of automatic memory management). Python is compiled to bytecode, but the bytecode is interpreted each time it is executed, much like PHP with a bytecode cache. There has been some work on JIT compilers for Python (Psyco was one, and PyPy has done a lot of work with JITs) but they aren't generally considered production-ready. (YMMV, of course.)
0
0
0
0
2013-06-05T23:28:00.000
2
1.2
true
16,951,484
0
0
1
2
JavaScript on the server can be interpreted to mashine code using Google's V8 Javascript Engine. But PHP and Ruby and Python and Java all have to run through an interpreter every time they're accessed and it interpretation will be less fast. Is that true? I read this in an article about Google's V8 Javascript Engine.
What is the best way to download number of pages from a list of urls?
16,961,651
0
5
1,273
0
python,multithreading,multiprocessing,scrapy,web-crawler
Scrapy is still an option. Speed/performance/efficiency Scrapy is written with Twisted, a popular event-driven networking framework for Python. Thus, it’s implemented using a non-blocking (aka asynchronous) code for concurrency. Database pipelining You mentioned that you want your data to be pipelined into the database - as you may know Scrapy has Item Pipelines feature: After an item has been scraped by a spider, it is sent to the Item Pipeline which process it through several components that are executed sequentially. So, each page can be written to the database immediately after it has been downloaded. Code organization Scrapy offers you a nice and clear project structure, there you have settings, spiders, items, pipelines etc separated logically. Even that makes your code clearer and easier to support and understand. Time to code Scrapy does a lot of work for you behind the scenes. This makes you focus on the actual code and logic itself and not to think about the "metal" part: creating processes, threads etc. But, at the same time, Scrapy might be an overhead. Remember that Scrapy was designed (and great at) to crawl, scrape the data from the web page. If you want just to download a bunch of pages without looking into them - then yes, grequests is a good alternative.
0
0
1
0
2013-06-06T08:32:00.000
4
0
false
16,957,276
0
0
1
1
I have a >100,000 urls (different domains) in a list that I want to download and save in a database for further processing and tinkering. Would it be wise to use scrapy instead of python's multiprocessing / multithreading? If yes, how do I write a standalone script to do the same? Also, feel free to suggest other awesome approaches that come to your mind.
Pyramid with Jinja2 running Python 3.3
16,975,273
1
1
347
0
python-3.x,pyramid,jinja2
There appears to be issues with the dev version of jinja2 that you are installing as they reimplement the python 3 port using a single codebase. I'd suggest going back to a previous release that is using 2to3.
0
0
0
0
2013-06-06T14:02:00.000
2
0.099668
false
16,964,137
0
0
1
2
I can't make Jinja2 2.8 work with Pyramid 1.4.2 and Python 3.3.2. I got this error: File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/Jinja2-2.8_devdev_20130604-py3.3.egg/jinja2/environment.py", line 765, in _load_template template = self.loader.load(self, name, globals) File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/Jinja2-2.8_devdev_20130604-py3.3.egg/jinja2/loaders.py", line 119, in load bucket = bcc.get_bucket(environment, name, filename, source) File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/Jinja2-2.8_devdev_20130604-py3.3.egg/jinja2/bccache.py", line 176, in get_bucket key = self.get_cache_key(name, filename) File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/Jinja2-2.8_devdev_20130604-py3.3.egg/jinja2/bccache.py", line 163, in get_cache_key if isinstance(filename, unicode): NameError: global name 'unicode' is not defined I have WebOb 1.2.3 and distribute 0.6.45. Thanks!!!
Pyramid with Jinja2 running Python 3.3
16,996,264
1
1
347
0
python-3.x,pyramid,jinja2
I had the same issue with Jinja2 2.7. pip install jinja2==2.6 solved the problem for me.
0
0
0
0
2013-06-06T14:02:00.000
2
1.2
true
16,964,137
0
0
1
2
I can't make Jinja2 2.8 work with Pyramid 1.4.2 and Python 3.3.2. I got this error: File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/Jinja2-2.8_devdev_20130604-py3.3.egg/jinja2/environment.py", line 765, in _load_template template = self.loader.load(self, name, globals) File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/Jinja2-2.8_devdev_20130604-py3.3.egg/jinja2/loaders.py", line 119, in load bucket = bcc.get_bucket(environment, name, filename, source) File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/Jinja2-2.8_devdev_20130604-py3.3.egg/jinja2/bccache.py", line 176, in get_bucket key = self.get_cache_key(name, filename) File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/Jinja2-2.8_devdev_20130604-py3.3.egg/jinja2/bccache.py", line 163, in get_cache_key if isinstance(filename, unicode): NameError: global name 'unicode' is not defined I have WebOb 1.2.3 and distribute 0.6.45. Thanks!!!
PyV8 disable automatic garbage collection
17,597,335
4
4
482
0
javascript,python,garbage-collection,v8,pyv8
It's possible to disable garbage collection for good by changing the source code of V8. In V8's source, edit src/heap.cc, and put a return statement in the beginning of Heap::CollectGarbage. Other than that, it's not possible (AFAICT): V8 will always invoke garbage collection when it's about to run out of memory. There is no (configurable) way to not have it do that.
0
0
0
1
2013-06-09T03:30:00.000
1
1.2
true
17,006,134
1
0
1
1
I'm having an issue which seems to be related with the way Python & PyV8's garbage collection interact. I've temporarily solved the issue by disabling python's garbage collection, and calling gc.collect and PyV8.JSEngine.collect together every few seconds when no JavaScript is being run. However, this seems like a pretty hackish fix... in particular, I'm worried PyV8 might decide to collect at an inopportune time and cause problems, anyway. Is there any way to disable PyV8's automatic garbage collection for good, at least until I have a few days to spend figuring out exactly what is going on and thus to actually fix the issue?
How to recognize user login when log in comes from cookie?
17,010,697
3
1
124
0
python,django,session,cookies,login
I would do this in middleware. Have an attribute in the profile, or the session, which records the date the user was last seen, and in the middleware check if it is < today: if so, award the points and update the field.
0
0
0
0
2013-06-09T14:28:00.000
1
1.2
true
17,010,636
0
0
1
1
In our project we give the users points for every day they visit the site. The issue is that the user doesn't always log in in an explicit way (e.g. submitting login form), but often when he comes back he's logged in thanks to the cookie session id set by Django and we can't recognize his login in any way. How can I check if the user has logged in this way?
Database access strategy for a Python web app
17,012,369
4
4
351
1
python,psycopg2
Have you looked in to SQLAlchemy at all? It takes care of a lot of the dirty details - it maintains a pool of connections, and reuses/closes them as necessary.
0
0
0
0
2013-06-09T17:36:00.000
2
1.2
true
17,012,349
0
0
1
1
I've been writing a Python web app (in Flask) for a while now, and I don't believe I fully grasp how database access should work across multiple request/response cycles. Prior to Python my web programming experience was in PHP (several years worth) and I'm afraid that my PHP experience is misleading some of my Python work. In PHP, each new request creates a brand new DB connection, because nothing is shared across requests. The more requests you have, the more connections you need to support. However, in a Python web app, where there is shared state across requests, DB connections can persist. So I need to manage those connections, and ensure that I close them. Also, I need to have some kind of connection pool, because if I have just one connection shared across all requests, then requests could block waiting on DB access, if I don't have enough connections available. Is this a correct understanding? Or have I identified the differences well? In a Python web app, do I need to have a DB connection pool that shares its connections across many requests? And the number of connections in the pool will depend on my application's request load? I'm using Psycopg2.
Pay Per Request in Django
17,021,455
3
0
228
0
python,django
You can do everything web with Django just like with any other webframework/weblibrary. Probably the easiest way would be to have a user-profile, and as soon as the payment has been working out you add this video to the users "allowed" list. This makes it quite easy to show the users available videos. The redirection thing after payment really depends on your provider, paypal and others allow you to embed their payment process into your application, and have powerful APIs to check for "incoming" payments.
0
0
0
0
2013-06-10T10:03:00.000
2
1.2
true
17,021,318
0
0
1
2
Is it possible to implement this in django: In a video site, for every video a user want to watch he/she must pay a fee before watching the video. If it's possible, what's the best way to implement this. And after every successful payment, how can the user be redirected back to the particular video he paid for?
Pay Per Request in Django
17,021,565
0
0
228
0
python,django
I believe this is possible. What you can do is have a check on your video page for a certain receipt that you can add as an entry in the UserProfile model that you'll have for your django website. Now this receipt will only be generated when your user goes through the complete payment path which you can handle by scripts. And as for redirection, you can have the payment processing service redirect to your receipt token generating django view that handles the addition of the user to your whitelist for that video.
0
0
0
0
2013-06-10T10:03:00.000
2
0
false
17,021,318
0
0
1
2
Is it possible to implement this in django: In a video site, for every video a user want to watch he/she must pay a fee before watching the video. If it's possible, what's the best way to implement this. And after every successful payment, how can the user be redirected back to the particular video he paid for?
Set break points in Tornado app
20,555,024
2
3
1,963
0
debugging,python-2.7,tornado
If you are running your app using foreman you would set you environment variable in .env file in root project folder. Setting the below env variable in my .env file did the tick form me. PYTHONUNBUFFERED=true Now I can set code breakpoints in my app, and also print output to server logs while running the app using foreman.
0
1
0
0
2013-06-10T18:46:00.000
2
1.2
true
17,030,677
0
0
1
1
How could I set a break point in my tornado app? I tried pdb, but Tornado app seams to be ignoring my pdb.set_trace() command in my app.
How to implement unsubscribe usecase for website
17,033,151
1
0
138
0
google-app-engine,email,python-2.7,webapp2,unsubscribe
Each new class implies a new query, which adds to the total cost. Pack as much information that is practical into the User class. A simple boolean in the User class should work for active/inactive or subscribe/unsubscribe. Your app needs to accept emails to receive the Unsubscribe request and set the associated boolean to False.
0
1
0
0
2013-06-10T19:12:00.000
1
1.2
true
17,031,075
0
0
1
1
I'm sending automated emails and hence I should deliver an unsubscribe function. I have a User entity that is not used much, only when a user registers and the emails can be send to users who are not registered as Users. So when I send an email and I must include an unsubscribe link, should I keep a whole separate entity / class for class Unsubscriptions or include them as a variable in the User class whether or not a user is registered to receive emails? Did you use any method for unsubscribe that you can recommend? Are there any frameworks for unsubriptions? GAE that I'm using has a very primitive framework for sending and receiving emails and I understand that Amazon has a much more developed API for manging large email list, but I suppose I can still do it all in GAE without Amazon though that would take longer time so I'm considering managing large email lists from Amazon. I have > 10 000 registered users that I never emailed and I'd like to email them a reminder that they are welcome to use my application and that they can unsubscribe from future mailings.
Communicating with a Node.js server application
17,039,955
2
1
361
0
python,node.js,socket.io
Expose a Restful API on the chat server. Then your Django web application can easily make API calls to modify state in the chat server. Doing anything else is more complicated and most likely unnecessary.
0
0
1
0
2013-06-11T08:44:00.000
1
0.379949
false
17,039,873
0
0
1
1
I am building a chat application that consists of a Django web backend with a Node.js/socket.io powered chat server. There will be instances when changes made via the web interface (e.g. banning a user) need to be pushed immediately to the chat server. I can think of the following options: Use a Python-based socket.io client to interface directly with the server (what are some good Python clients?) Use redis or a message queue to do pub/sub of events (seems like overkill) implement a simple TCP wire protocol on a secondary localhost-only port (this could be done using the built-in Node and Python TCP libraries) What would be the best option?