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
OpenERP. How to make multiple invoices on a sale order when it contains products from different companies?
22,589,593
0
0
632
0
python,openerp,invoice,erp
you have to override a create method in Invoice Model
0
0
0
0
2014-03-15T04:57:00.000
1
0
false
22,419,733
0
0
1
1
How to make multiple invoices on a sale order when it contains products from different companies? My configuration is: - Main Company has: sub company 1, sub company 2. These companies has many products. I wish make multiple invoices when I create a sale order if it contains products from different companies. For examp...
How many objects should I retrieve from server and How many can be stored in NSCache?
22,482,214
0
1
54
0
python,iphone,nscache,memory-optimization
Maybe you should use NSData to retrieve data from your service instead of NSCache. NSCache is for temporary objects, however NSData is used to move data between applications (from your service to your app) Description of NSCache by Apple: An NSCache object is a collection-like container, or cache, that stores key-valu...
0
0
0
0
2014-03-15T15:19:00.000
1
0
false
22,425,631
0
0
1
1
My service return up to 500 objects at time i've notice that my iphone application is crashing when the amount of data goes over 60 objects. to workaround this issue I'm running a query that brings back only the top 40 results but that is slower than just returning the entire data what are the best practices and how c...
How to include libraries through the python local server
22,430,282
1
1
197
0
python,d3.js,local
The SimpleHTTPServer module will only serve things that are within the directory you're telling it to serve and folders beneath that directory, for security reasons. (Otherwise a visitor could ask it for e.g. ../../../../etc/passwd or similar.) If you want to serve scripts and other assets, you'll need to put them in a...
0
0
1
0
2014-03-15T15:48:00.000
1
0.197375
false
22,426,005
0
0
1
1
I'm currently running an html and jsp file locally and hosting it by running this command through the terminal: python -m SimpleHTTPServer 8888 &. This has been going smoothly, but I recently ran into an issue where I have to include library files (d3, jQuery, ajax, etc.) I've included the following command in my html ...
Best practice for setting up Flask+uWSGI+nginx
22,432,964
0
7
3,061
0
python,nginx,flask,uwsgi
What you are asking for is not "best practices", but "conventions". No, there are no conventions in the project about paths, privileges and so on. Each sysadmin (or developer) has its needs and tastes, so if you are satisfied with your current setup... well "mission accomplished". There are no uWSGI gods to make happy ...
0
0
0
0
2014-03-16T04:05:00.000
3
0
false
22,432,826
0
0
1
1
I'm trying to set up my first web server using the combination of Flask, uWSGI, and nginx. I've had some success getting the Flask & uWSGI components running. I've also gotten many tips from various blogs on how to set this up. However, there is no consistency and the articles suggest many different ways of setting thi...
How to play a note as long as I hit the key (Fluidsynth)?
22,449,199
1
0
317
0
python,midi,synthesizer,fluidsynth
In MIDI if you send a note on message it stays on until you send a note off. Maybe you are sending a note on every time you check the state of the button? If so, you shouldn't, send the note on/note off only when the button state changes.
0
0
0
1
2014-03-16T10:34:00.000
1
1.2
true
22,435,753
0
0
1
1
I'm working on a Raspberry Pi project at the moment and I'm searching for a possibility to play a note as long as ey press a button (connected with gpio). I use pyFluidsynth and got it working but it's note holding a note as long as i press a button, it repeats it really fast but to slow not to hear it. Is there any c...
django.fcgi or virtualenv : no module named operator
22,452,380
2
0
2,136
0
python,django
Since the operator module is part of the standard library, it looks like you have a corrupt Python installation in your virtualenv. The best thing to do would be to simply delete and recreate your virtualenv.
0
0
0
0
2014-03-17T10:45:00.000
1
1.2
true
22,452,284
0
0
1
1
So these are my website informations: framework : Django hosting : alwaysdata python : 2.7 virtualenv is used The problem : I have the non explicit 500 error :Internal Server Error I have not any error log But : I found a trail to solve this issue. Indeed when i run manually the django.fcgi, i got this traceback: T...
Django background monitor service
22,575,690
0
0
128
0
python,django,monitor
Well, there are many ways to do this. One would be a simple daemon (card observer) script that reads the card data every second or so and puts it in a memcached/db/file. Then you simply read it in the view. Once you get this working, you may want to take another course, like running a observer thread from Django etc.
0
0
0
0
2014-03-17T20:17:00.000
1
1.2
true
22,464,447
0
0
1
1
I have a django-based website. And I have an RFID-reader used by the django site. The reader's have a monitor, and a function, wich gives back the uid of the inserted card. When card isn't inserted, it gives back None. I'd like to "run" the monitor's code while the django site is running, and I'd like to call the funct...
Need Django Package for S3
22,474,074
0
0
67
0
python,django,amazon-s3
django-storages works quite well and many other Django products rely on it. It does provide other storage services besides S3 but, of course, you don't need to use any of the others. It does need to know your AWS access key & secret key, but you don't need to actually put those values in your settings.py; typically, yo...
0
0
0
0
2014-03-18T07:56:00.000
1
0
false
22,473,370
0
0
1
1
I am looking for a simple but effective S3 based Django Package through which subscribers from the website can directly use storage services without any hassle. I am a beginner for django so really looking for something simple to use. Please recommend something exactly as per requirement as previously I've found some r...
Making a field "blank=False" in production
22,474,781
3
0
104
0
django,python-2.7,django-models,django-forms
No. blank is enforced solely at the application level.
0
0
0
0
2014-03-18T09:07:00.000
2
1.2
true
22,474,657
0
0
1
1
I have deployed my Django website but just now realized that I didn't make one of the fields compulsory. For the field it is currently, blank=True, null=True Now if I go ahead and change it to blank=False will there be any effect on the database and already existing data in it?
Django calling REST API from models or views?
22,479,708
6
10
4,474
0
python,django,rest,django-models,django-views
I think it is an opinion where to call web services. I would say don't pollute your models because it means you probably need instances of those models to call these web services. That might not make any sense. Your other choice there is to make things @classmethod on the models, which is not very clean design I would ...
0
0
0
0
2014-03-18T12:15:00.000
2
1.2
true
22,479,095
0
0
1
2
I have to call external REST APIs from Django. The external data source schemas resemble my Django models. I'm supposed to keep the remote data and local ones in sync (maybe not relevant for the question) Questions: What is the most logical place from where to call external web services: from a model method or from a...
Django calling REST API from models or views?
22,479,360
3
10
4,474
0
python,django,rest,django-models,django-views
What is the most logical place from where to call external web services: from a model method or from a view? Ideally your models should only talk to database and have no clue what's happening with your business logic. Should I put the code that call the remote API in external modules that will be then called by the ...
0
0
0
0
2014-03-18T12:15:00.000
2
0.291313
false
22,479,095
0
0
1
2
I have to call external REST APIs from Django. The external data source schemas resemble my Django models. I'm supposed to keep the remote data and local ones in sync (maybe not relevant for the question) Questions: What is the most logical place from where to call external web services: from a model method or from a...
Python Django: Load Autofield to MySql Table using loaddata
22,500,375
1
0
344
0
python,mysql,django
Found the solution - I had to use dumpdata app.model --natural
0
0
0
0
2014-03-18T15:03:00.000
1
0.197375
false
22,483,205
0
0
1
1
I have a model with two DateField - fields in it, which I dumped to JSON using dumpdata. Now I want to load those fixtures (I am using South) to my MySQL-Database which leads to the following Error: CommandError: The database backend does not accept 0 as a value for AutoField. Does anybody know that problem and the ...
AWS EC2 not running web server on default port
22,513,826
2
3
647
0
python,django,amazon-web-services,amazon-ec2
sudo python manage.py runserver 0.0.0.0:80 did the trick.
0
0
0
0
2014-03-18T20:24:00.000
1
1.2
true
22,490,257
0
0
1
1
I am new to AWS setup: here are the steps i followed to setup a Django web server. ( but its not running on public ip ) created AWS instance installed Django 1.6.2 created sample app added security group (Inbound Requests) of running instance with HTTP - TCP - 80 - 0.0.0.0/0 tried following ways to run server. python ...
Server side python code runing continuosly per session
22,520,376
1
0
183
0
python,django,session,flask,server-side
Celery is a great solution, but it can be overpowered for many setups. If you just need tasks to run periodically (once an hour, once a day, etc) then consider just using cron. There's a lot less setup and it can get you quite far.
0
0
0
0
2014-03-19T03:42:00.000
2
0.099668
false
22,495,767
0
0
1
1
I have searched the forums for my question but im either searching for a thing naming it wrongly or the question is hard which i really doubt. I am developing a web-app which would have an web-interface written in one of the MVC frameworks like django or even flask and allow user to login, will identify users session a...
Should I deploy only the .pyc files on server if I worry about code security?
22,497,827
11
6
6,259
0
python,django,cloud,wsgi
Deploying .pyc files will not always work. If using Apache/mod_wsgi for example, at least the WSGI script file still needs to be straight Python code. Some web frameworks also may require the original source code files to be available. Using .pyc files also does little to obscure any sensitive information that may be i...
0
0
0
1
2014-03-19T03:54:00.000
4
1.2
true
22,495,894
0
0
1
3
I want to deploy a Django application to a cloud computing environment, but I am worried about source code security. Can I deploy only the compiled .pyc files there? According to official python doc, pyc files are 'moderately hard to reverse engineer'. What are the pros and cons of taking this approach? Is this a stand...
Should I deploy only the .pyc files on server if I worry about code security?
22,496,250
1
6
6,259
0
python,django,cloud,wsgi
Generally, deploying PYC files will work fine. The Pros, as you said, a bit helpful for protecting source codes. Cons, here are the points I found: 1). PYC only works with same Python version. E.g., "a.pyc" was compiled by Python2.6, "b.pyc" was by 2.7, and b.pyc "import a", it won't work. Similarly, "python2.6 b.pyc" ...
0
0
0
1
2014-03-19T03:54:00.000
4
0.049958
false
22,495,894
0
0
1
3
I want to deploy a Django application to a cloud computing environment, but I am worried about source code security. Can I deploy only the compiled .pyc files there? According to official python doc, pyc files are 'moderately hard to reverse engineer'. What are the pros and cons of taking this approach? Is this a stand...
Should I deploy only the .pyc files on server if I worry about code security?
22,495,975
1
6
6,259
0
python,django,cloud,wsgi
Yes, just deploying the compiled files is fine. Another point to consider are the other aspects of your application. One aspect could be if current bugs let malicious users know what technology stack you are using, type of error messages displayed when (if) your application crashes. To me, these seem like some of the o...
0
0
0
1
2014-03-19T03:54:00.000
4
0.049958
false
22,495,894
0
0
1
3
I want to deploy a Django application to a cloud computing environment, but I am worried about source code security. Can I deploy only the compiled .pyc files there? According to official python doc, pyc files are 'moderately hard to reverse engineer'. What are the pros and cons of taking this approach? Is this a stand...
How to cache data to be used in multiple ways at a single URL
22,516,105
0
0
64
0
python,django,performance,caching
I think your idea to store the prepped data in a file is a good one. I might name the file something like this: /tmp/prepped-data-{{session_id}}.json You could then just have a function in each view called get_prepped_data(session_id) that either computes it or reads it from the file. You could also delete old files wh...
0
0
0
0
2014-03-19T16:01:00.000
1
0
false
22,511,568
0
0
1
1
Let's say I have a page I'd like to render which will present some (expensive to compute) data in a few ways. For example, I want to hit my database and get some large-size pile of data. Then I want to group that data and otherwise manipulate it in Python (for example, using Pandas). Say the result of this manipulat...
Can you display python web code in Joomla?
22,783,076
0
5
5,932
0
php,python,joomla,cherrypy,joomla3.0
Before considering Python What are you wanting to customize? (perhaps some clever Javascript or a Joomla extension already exists) Is the Joomla-way not a better solution for your problem, given the fact that you're using Joomla? (change the template, or the view-templates of the modules and component in particular) i...
0
0
0
1
2014-03-19T16:32:00.000
5
0
false
22,512,321
0
0
1
1
I'm building a Joomla 3 web site but I have the need to customize quite a few pages. I know I can use PHP with Joomla, but is it also possible to use Python with it? Specifically, I'm looking to use CherryPy to write some custom pieces of code but I want them to be displayed in native Joomla pages (not just iFrames). ...
Bind to LDAP after SSO?
22,533,335
1
1
153
0
php,python,ldap,single-sign-on,saml
Rather than using the user's credentials to bind to LDAP, get an application account at LDAP that has read permissions for the attributes you need on the users within the directory. Then, when you get the username via SSO, you just query LDAP using your application's ID. Make sure you make your application ID's passwor...
0
0
1
0
2014-03-19T20:39:00.000
1
0.197375
false
22,517,604
0
0
1
1
I have this web application with LDAP backend, to read and modify some LDAP attributes. Web application use the SSO (Single Sign-on) to authenticate user. How can I bind to LDAP, if I only get a user name as an attribute from SSO, withouth asking for password again, because it will make SSO useless? I use SimpleSAMLphp...
Local server giving wrong files. Is it possible I'm running 2 python servers?
22,522,021
1
2
1,036
0
python,localhost,simplehttpserver,localserver
Only one process can listen on a port; you cannot have two SimpleHTTPServer processes listening on the same port. You can however leave an old server process up and then disregard failed startup of the new server process or error message about automatic port conflict resolution. To debug this process, use netstat ( ...
0
0
0
0
2014-03-20T01:54:00.000
2
1.2
true
22,521,912
0
0
1
2
I'm in the directory /backbone/ which has a main.js file within scripts. I run python -m SimpleHTTPServer from the backbone directory and display it in the browser and the console reads the error $ is not defined and references a completely different main.js file from something I was working on days ago with a local p...
Local server giving wrong files. Is it possible I'm running 2 python servers?
67,453,910
0
2
1,036
0
python,localhost,simplehttpserver,localserver
I recently had this problem and it was due to the old page being stored in the browser cache. Accessing the port from a different browser worked for me (or you can clear your cache).
0
0
0
0
2014-03-20T01:54:00.000
2
0
false
22,521,912
0
0
1
2
I'm in the directory /backbone/ which has a main.js file within scripts. I run python -m SimpleHTTPServer from the backbone directory and display it in the browser and the console reads the error $ is not defined and references a completely different main.js file from something I was working on days ago with a local p...
Shared lock for Python objects
22,524,103
1
0
1,254
0
python,multithreading,locking
Since the updates are so infrequent, you're better off just making a copy of the object, updating copy, and then updating the global variable to point to the new object. Simple assignments in python are atomic so you don't need any locks at all.
0
0
0
0
2014-03-20T03:19:00.000
1
1.2
true
22,522,802
1
0
1
1
I'm developing a tiny web application with Flask/Gunicorn on Heroku. Since I'm just prototyping, I have a single web process (dyno) with a worker thread started by the same process. The web application is just returning a JSON dump of a global object, which is periodically updated by the worker thread monitoring an ext...
Different Postgres users for syncdb/migrations and general database access in Django
22,527,486
1
3
78
1
python,django,postgresql
From ./manage.py help syncdb: --database=DATABASE Nominates a database to synchronize. Defaults to the "default" database. You can add another database definition in your DATABASES configuration, and run ./manage.py syncdb --database=name_of_database_definition. You might want to create a sm...
0
0
0
0
2014-03-20T04:28:00.000
1
0.197375
false
22,523,519
0
0
1
1
I'm using Django 1.6 with PostgreSQL and I want to use a two different Postgres users - one for creating the initial tables (syncdb) and performing migrations, and one for general access to the database in my application. Is there a way of doing this?
Realtime forms in Django
22,533,787
0
0
81
0
jquery,python,django
I think ajax should do the trick for you
0
0
0
0
2014-03-20T12:12:00.000
1
0
false
22,532,644
0
0
1
1
I have a website and I want to have a form on the website that multiple people can view. As the firm gets updated by any of the individuals looking at it, everyone else can also see the updates without refreshing the web page. Basically it will be a row from a table displayed as a form and each part of the form will be...
Exchange data between Python and PHP
22,542,914
1
4
419
0
php,python
Write a Python script that takes a path in sys.argv or the audio data via sys.stdin and writes metadata to sys.stdout. Call it from PHP using exec.
0
0
0
1
2014-03-20T18:56:00.000
1
0.197375
false
22,542,566
0
0
1
1
Is it possible to exchange data between a PHP page and a Python application? How can I implement a PHP page that reacts to a Python application? EDIT: My application is divided in 2 parts: the web backend and a Python daemon. Via the web backend I upload MP3s to my server; these MP3s are processed by my Python daemon w...
How to retrieve Facebook friend's information with Python-Social-auth and Django
41,433,786
1
11
7,106
0
python,django,facebook,facebook-graph-api,python-social-auth
Just some extra for the reply above. To get the token from extra_data you need to import the model with that data (took me a while to find this): from social.apps.django_app.default.models import UserSocialAuth
0
0
0
0
2014-03-21T00:57:00.000
2
0.099668
false
22,548,223
0
0
1
1
How can I retrieve Facebook friend's information using Python-Social-auth and Django? I already retrieve a profile information and authenticate the user, but I want to get more information about their friends and invite them to my app. Thanks!
Paypal, encrypted add to cart button generate dynamically
22,621,678
2
0
383
0
python,paypal
Your question embodies a contradiction in terms. The purpose of so-called encrypted buttons is for Paypal to check that they exist as registered buttons. If you roll your own buttons, Paypal can't do that. You're looking at the problem the wrong way. If someone chooses to send you money, that's very nice, but unless it...
0
0
0
0
2014-03-21T18:54:00.000
1
0.379949
false
22,567,255
0
0
1
1
in my current web application project, I'm developing a small commerce with many products... I need to implement PayPal for payments and I have read a lot of documentation in paypal developer site. The solution of implement Payment standard Buttons (add to cart button in my case) is fantastic, but I need to auto gener...
Sync data with Local Computer Architecture
22,629,711
0
0
63
0
python,django,data-binding,architecture
Sounds like you need a message queue. You would run a separate broker server which is sent tasks by your web app. This could be on the same machine. On your two local machines you would run queue workers which connect to the broker to receive tasks (so no inbound connection required), then notify the broker in real tim...
0
0
1
0
2014-03-24T06:24:00.000
2
0
false
22,602,390
0
0
1
1
The scenario is I have multiple local computers running a python application. These are on separate networks waiting for data to be sent to them from a web server. These computers are on networks without a static IP and generally behind firewall and proxy. On the other hand I have web server which gets updates from the...
How to code in openerp so that user can create his fields?
22,627,251
0
0
103
0
python,openerp
The user can add fields, models, can customize the views etc from client side. These are in Settings/Technical/Database Structure, here you can find the menus Fields, Models etc where the user can add fields. And the views can be customized in Settings/Technical/User Interface.
0
0
0
0
2014-03-24T08:46:00.000
1
0
false
22,604,620
0
0
1
1
I have been developing modules in OpenERP-7 using Python on Ubuntu-12.04. I want to give my users a feature by which they will have the ability to create what ever fields they want to . Like they will set the name, data_type etc for the field and then on click , this field will be created. I dont have any idea how this...
When I try to run 'cfx run' or 'cfx test' using the Mozilla Add-On SDK, my application binaries are not found
22,612,244
3
1
730
0
python,macos,firefox,firefox-addon,firefox-addon-sdk
It's looking for the Firefox binary file, not your application's binaries. You have to install Firefox because cfx run will open a browser with your add-on installed so you can use it and test it live. If firefox is already installed, then it is in a non-standar path, so you must tell cfx command where to find it, thi...
0
1
0
0
2014-03-24T13:19:00.000
1
1.2
true
22,610,616
0
0
1
1
I installed the the latest Add-On SDK by Mozilla (version 1.15). Installation was successful and when I execute cfx I get a list of all possible commands. I made a new separate empty folder, cd'd into it and ran cfx init. This was also successful and all necessary folders and files got created. Now when I try to run t...
Django: Core library and South migrations
22,619,479
0
0
78
0
python,django,django-south
Well... the answer is to use apps. That's what they're for. They were designed the way the are exactly because standard modules don't provide the level of integration needed. If you start hacking away on your library to make it work on its own, you'll end up with mess of code and glue about the same size of a django ap...
0
0
0
0
2014-03-24T20:00:00.000
1
1.2
true
22,619,437
0
0
1
1
I'm currently working on a django project which tends to get pretty complex in time. Therefore I'm planning to encapsulate basic core models and utilities that are going to be reused throughout the application in a separate space. Since these models are mostly base models needed by other apps, imho there's no need to c...
Flask accept request data as a stream without processing?
22,659,358
1
0
92
0
python,flask
The Werkzeug Request object heavily relies on properties and anything that touches request data is lazily cached; e.g. only when you actually access the .form attribute would any parsing take place, with the result cached. In other words, don't touch .files, .form, .get_data(), etc. and nothing will be sucked into memo...
0
0
0
0
2014-03-25T05:36:00.000
1
1.2
true
22,626,203
0
0
1
1
I have an endpoint in my Flask application that accepts large data as the content. I would like to ensure that Flask never attempts to process this body, regardless of its content-type, and always ensures I can read it with the Rquest.stream interface. This applies only to a couple of endpoints, not my entire applicati...
Good places to deploy a simple Django website
22,655,516
0
0
125
0
python,django,hosting
Hosting yourself can be cheaper, but you will have to spend some time maintaing the system to keep it safe. Choosing a service may be a bit more expansive but you don't have to deal with the system itself. Choose your best.
0
0
0
0
2014-03-26T08:39:00.000
3
0
false
22,655,420
0
0
1
2
I am looking for options on places to host a Django site. Should I find a service that already has the proper programs and dependencies installed? Or can I gain access to a server and install them myself?
Good places to deploy a simple Django website
22,655,606
1
0
125
0
python,django,hosting
Webfaction Heroku Google App Engine AWS Elastic Beanstalk Windows Azure But, cheaper, do it yourself. VPS's these days are quite cheap (digitalocean.com $5/month). An easy to manage combination: Ubuntu + Nginx + Gunicorn, and follow some tutorials about how to secure and update your VPS.
0
0
0
0
2014-03-26T08:39:00.000
3
0.066568
false
22,655,420
0
0
1
2
I am looking for options on places to host a Django site. Should I find a service that already has the proper programs and dependencies installed? Or can I gain access to a server and install them myself?
Display single record in django modeladmin
22,660,278
2
0
166
0
python,django,django-models,django-admin
i will suggest you to do something like below i am doing . Django admin provided you to create a method of particular field name which you have defined into list_display. In that method you are ovveride return content for that field like below. class AAdmin(admin.ModelAdmin): list_display = ('id', 'email_settings'...
0
0
0
0
2014-03-26T11:53:00.000
1
1.2
true
22,660,190
0
0
1
1
I want to implement something like this: I have model A admin with a status field which is a link to the model B admin. Now when i click on column for the row with link for model B admin it should go to model B admin which it is currently doing but it should only display a single record out of all the records model B f...
Database engine choice for Django/ Python application
22,664,876
1
1
759
1
python,database,django,sqlite,postgresql
use postgreSQL, our team worked with sqlite3 for a long time. However, when you import data to db,it often give the information 'database is locked!' The advantages of sqlite3 it is small,as you put it, no server setup needed max_length in models.py is not strictly, you set max_length=10, if you put 100 chars in the f...
0
0
0
0
2014-03-26T13:26:00.000
2
0.099668
false
22,662,456
0
0
1
1
I am working on a Python/Django application. The core logic rests in a Python application, and the web UI is taken care of by Django. I am planning on using ZMQ for communication between the core and UI apps. I am using a time-series database, which uses PostgreSQL in the background to store string data, and another t...
request.method == "post" returns a false, but
22,666,767
0
0
164
0
django,python-2.7,django-forms
request.POST is a dictionary. When it is not empty it returns True. request.method == 'POST' (note the upper-case for POST and the double equal sign ==) is checking the method. I believe that you made request.method = 'post' which is clearly not what you meant.
0
0
0
0
2014-03-26T16:01:00.000
1
0
false
22,666,642
0
0
1
1
I am adding data from a ModelForm to the db, but "if request.POST returns" a true, and if "request.method = 'post'" returns a false. How can that be? From what I understand it is supposed to work the other way around.
Can't get Django/Postgres app settings working on Heroku
22,693,845
5
3
1,923
1
python,django,postgresql,heroku
Have you set your DJANGO_SETTINGS_MODULE environment variable? I believe what is happening is this: by default Django is using your local.py settings, which is why it's trying to connect on localhost. To make Django detect and use your production.py settings, you need to do the following: heroku config:set DJANGO_SETTI...
0
0
0
0
2014-03-26T22:12:00.000
1
1.2
true
22,674,128
0
0
1
1
I'm making a Django app with the Two Scoops of Django template. Getting this Heroku error, are my Postgres production settings off? OperationalError at / could not connect to server: Connection refused Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432? Exception Locat...
Flask Session will not Persist
22,688,640
6
5
2,289
0
python,flask,session-variables
Problem was that I had the key static in my init which caused it to work in dev but in production in the .wsgi it was still dynmaic, I have changed this and all seems to be working now.
0
0
0
0
2014-03-26T23:18:00.000
1
1.2
true
22,675,084
0
0
1
1
I have recently deployed my first Flask application (first web application ever actually), one problem I am running into and haven't had luck tracking down is related to sessions. What I am doing is when the user logs in I set session['user'] = user_id and what is happening is I occasionally get a key error when makin...
High CPU usage for DJango 1.4 on Windows 2012
22,773,695
0
0
94
0
performance,python-2.7,32-bit,windows-server-2012
The issue was in 32-bit version of Python shipped with Zoo. Installing a 64-bit version and modifying the Zoo engine to use it, has boosted things significantly.
0
1
0
0
2014-03-27T06:26:00.000
1
1.2
true
22,679,857
0
0
1
1
We migrated to Helicon Zoo on Windows 2012 (from ISAPI on 2008). Problem is that the users started complaining about random slowdowns and timeouts with the application. The Python is 2.7 32-bit (due to Zoo requirements). That said, the problem is not Zoo related, as the runserver seems to exhibit same issues. The CPU s...
Django dev server request.META has all my env vars
54,917,188
2
11
703
0
python,django
I just ran into this as well which caught me by surprise, I thought my page was sending all my env variables to the server. I use the env to store credentials so I was concerned. Any application running in your environment has access to your env variables, therefore the server has access to your env variables. Bottom...
0
0
0
0
2014-03-27T12:48:00.000
2
0.197375
false
22,688,151
0
0
1
1
Why do I see all my environment variables in request.META when using the dev server?
Multiple assignment of variables in coffee
22,692,398
16
6
3,111
0
javascript,python,coffeescript
Try with [a, b, c] = ['this', 'is', 'variables'].
0
0
0
0
2014-03-27T15:33:00.000
1
1.2
true
22,692,291
1
0
1
1
Can I assign multiple variables in coffee like in python: a, b, c = 'this', 'is', 'variables' print c >>>variables
Security concerning MongoDB on ec2?
22,716,431
2
1
182
1
python,mongodb,security,amazon-web-services,amazon-ec2
EC2 security policies by default block all incoming ports except ones you have sanctioned, as such the firewall will actually stop someone from getting directly to your MongoDB instance; as such yes it is secure enough. Since the instances are physically isolated there is no chance of the problems you would get on shar...
0
0
0
0
2014-03-28T14:39:00.000
2
0.197375
false
22,715,888
0
0
1
2
I'm using a flask on an ec2 instance as server, and on that same machine I'm using that flask talking to a MongoDB. For the ec2 instance I only leaves port 80 and 22 open, without leaving the mongo port (27017) because all the clients are supposed to talk to the flask server via http calls. Only in the flask I have co...
Security concerning MongoDB on ec2?
22,716,299
2
1
182
1
python,mongodb,security,amazon-web-services,amazon-ec2
Should be secure enough. If I understand correctly, you don't have ports 27017 open to the world, i.e. you have (or should)block it thru your aws security group and perhaps your local firewall on the ec2 instance, then the only access to that port will be from calls originating on the same server. Nothing is 100% secur...
0
0
0
0
2014-03-28T14:39:00.000
2
1.2
true
22,715,888
0
0
1
2
I'm using a flask on an ec2 instance as server, and on that same machine I'm using that flask talking to a MongoDB. For the ec2 instance I only leaves port 80 and 22 open, without leaving the mongo port (27017) because all the clients are supposed to talk to the flask server via http calls. Only in the flask I have co...
How to check if there are errors in python
22,719,539
3
1
182
0
python,google-app-engine
If you are using the App Engine Launcher then by clicking on the Logs you can see all the logs and errors. An alternative way is to start the development server via the command line (as it's already mentioned) and you will see all the logs there, which makes it much easier to work with because the Logs windows is not t...
0
1
0
0
2014-03-28T15:45:00.000
2
1.2
true
22,717,414
1
0
1
1
While using Google App Engine if there is an error in python the result is a blank page. It is difficult to debug python since you don't get line number on which there is error. It is extremely frustrating when you get blank page because of indentation error. Is there any way to execute python google app engine script ...
Using Javascript variables in Python
22,718,068
3
1
202
0
javascript,python,tornado
No. What you are doing in Tornado is constructing some HTML and javascript as text, ready to be sent to the user's browser to be interpreted. On the server, it is only text. You can put values from Python into the text, because the Python is running on the server. There is a clear and complete separation between what h...
0
0
0
0
2014-03-28T16:11:00.000
1
0.53705
false
22,717,928
1
0
1
1
While working on Tornado template, I know we can use/work with Python variables in HTML/Javascript using {{python_variable}}. Similarly, is it possible to use Javascript variable in Python code, without passing to another file?
openERP 7 need to export data in UTF-8 CSV , but how?
22,756,295
1
0
574
0
python,postgresql,openerp,erp,openerp-7
Encodings are a complicated thing, and it is difficult to answer an encoding-related question without precise facts. ANSI is not an encoding, I assume you actually mean ASCII. And ASCII itself can be seen as a subset of UTF-8, so technically ASCII is valid UTF-8. OpenERP 7.0 only exports CSV files in UTF-8, so if you d...
0
0
0
0
2014-03-28T16:46:00.000
1
1.2
true
22,718,646
0
0
1
1
I can export a CSV with openERP 7 , but it is encoded in ANSI. I would like to have it as a UTF-8 encoded file. How can I achieve this ? The default export option in openERP doesn"t have any extra options. What files should be modified ? Or is there an app for this matter ? Any help would be appreciated.
Creating messenger for django
22,729,332
1
0
3,320
0
python,django,messenger
Or you can install xmpp server (like eJabberd) and write a server side interface over it. It will be easier, faster and optimal solution. Gmail and Facebook both uses xmpp protocol. People using your application will also be able to send chat request to their friends in gmail. You wont even have to write a website int...
0
0
0
0
2014-03-29T08:23:00.000
2
0.099668
false
22,728,758
0
0
1
1
I'm a learning Python/Django programmer and want to try to create an easy web-messenger. Is it real to write web-messenger for django? And does any modules for that exist or any open-source protocols support python?
django difference between validator and clean_field method
22,736,818
0
5
1,315
0
python,django,django-forms,django-validation
As far as I remember a field can have several validators (like min_length, max_length) which will be called by the default clean_field method.
0
0
0
0
2014-03-29T20:52:00.000
2
0
false
22,736,754
0
0
1
1
In a form in django, what is the difference between a validator for a field and a clean_<field> method for that field?
How to communicate between Django and Twisted when implementing a publish-subscribe pattern?
22,750,492
1
3
578
0
python,django,websocket,twisted,publish-subscribe
There are dozens or hundreds of ways to do inter-process communication. For example, you could use HTTP by running an HTTP server in one process and using an HTTP client in the other. The specific choice of protocol probably doesn't matter a whole lot. The particular details of the kind of communication you need migh...
0
1
0
0
2014-03-30T03:48:00.000
2
0.099668
false
22,740,033
0
0
1
1
I'm implementing a WebSocket server using Python and Autobahn (something that builds off of Twisted). What's the best way to let my Autobahn/Twisted server know that something has happened from within my Django application? More specifically, I'm implementing a notifications service and instant update service that auto...
How to get a redditors most down voted comment using PRAW?
23,044,806
0
0
585
0
python,praw
The sorting types available in PRAW are equivalent to those available on the webinterface, such as 'new', 'top' or 'controversial'. There isn't a special sort to retrieve worst comments. It may be silly to loop through all of them, but that's the only way to do what you want.
0
0
0
0
2014-03-30T03:53:00.000
2
0
false
22,740,059
0
0
1
2
Is there a way to get a redditors worst comment using praw? I have tried redditor.get_comments(sort="worst").next().body with different sorts but nothing produces the desired result. I suppose I could get all their comments and then loop through them but that seems silly.
How to get a redditors most down voted comment using PRAW?
40,520,320
1
0
585
0
python,praw
This is a little late, but probably the best way to do this is to sort by top, then use after=t1_d9pvq54 (for example) and a high count to quickly page through the comments until you get to the last one which will be the worst comment.
0
0
0
0
2014-03-30T03:53:00.000
2
0.099668
false
22,740,059
0
0
1
2
Is there a way to get a redditors worst comment using praw? I have tried redditor.get_comments(sort="worst").next().body with different sorts but nothing produces the desired result. I suppose I could get all their comments and then loop through them but that seems silly.
Scrapy: scraping website where targeted items are populated using document.write
22,757,917
2
0
428
0
python,web-scraping,scrapy
You can't do this, as scrapy will not execute the JavaScript code. What you can do: Rely on a headless browser like Selenium, which will execute the JavaScript. Afterwards, use XPath (or simple DOM access) like before to query the web page after executing the page. Understand where the contents come from, and load and...
0
0
1
0
2014-03-31T09:14:00.000
1
1.2
true
22,757,755
0
0
1
1
I am trying to scrap a website where targeted items are populated using document.write method. How can I get full browser html rendered version of the website in the Scrapy?
Openshift overrides email header 'from', 'reply-to' fields. How to send email without having to use SendGrid nor other paid email service.?
24,405,097
0
0
403
0
python,django,email,openshift,mezzanine
I myself is looking for free SMTP library to just send emails. So far not much luck. Tried java embedded SMTP library Aspirin. I am able to send mails but not very comfortable working with it as I keep getting some unknown exceptions. Apache James as another Java based SMTP server but don't think we can embed in the c...
0
0
0
0
2014-03-31T09:26:00.000
1
0
false
22,757,997
0
0
1
1
I have django 1.6 and python 2.7 deployed on Openshift. I notice that when the application sends emails out, Openshift overrides the email header by changing the 'From' field to 'no-reply@rhcloud.com' and ignore all 'Reply-to' field that has been set in the application. I have searched around and it seems like Openshi...
Where should I make heavy computations ? Client or server side?
22,761,056
6
2
1,700
0
javascript,python,web-applications,numpy
Consider both situations: If the computation is client-side, then your client gets loaded, the computation power of the client computer (which maybe is just a mobile phone or whatever) comes into play, and it won't matter much whether other users of the site are doing computations at the same time. On the other hand, ...
0
0
0
0
2014-03-31T11:50:00.000
1
1.2
true
22,760,837
0
0
1
1
I have a desktop application, made in Python, with PyQT and scipy / numpy. The aim of the program is, to find the optimal set of parameters for a differential equation, given some data. Thus, we use a numerical solver and an optimization routine from numpy. The computation is quite eavy, but also quick (30 sec max), ...
Use production App Engine datastore on development machine?
22,772,893
2
0
334
0
python,google-app-engine
TL;DR: We do not support having the dev_appserver use the real app-engine datastore. Even with the suggested use of "remote_api", AFAIK, the dev_appserver does not know how to use it. If you really want to make this work, you could write your own low-level API and have your own datastore abstraction that uses your API...
0
1
0
0
2014-03-31T15:22:00.000
2
1.2
true
22,765,563
0
0
1
1
Is it possible to setup the App Engine SDK on my local machine to use the live datastore while developing? Sometimes it's just easier for my workflow to work live. If not, is there an easy way to download or sync the live data to development machine? Thanks!
Disabling alerts and errors in Django File Uploader
22,808,378
0
0
17
0
javascript,python,django,file-upload
I've noticed that when using showMessage function when initializing plugin it can override default behaviour of the plugin. Problem solved.
0
0
0
0
2014-04-02T09:59:00.000
1
1.2
true
22,807,853
0
0
1
1
I'm using this plugin: https://github.com/zmathew/django-ajax-upload-widget and I'm wondering if there is any way of disabling alerts/notifications when upload fails without changing plugin code? I want to use bootstrap notifications instead of this ugly default alert popups, but also I have to use Django Eggs so I ca...
Are there any three-way data binding frameworks between the DOM, JavaScript, and server-side database for AngularJS and Django?
22,821,198
0
4
1,890
0
javascript,python,django,angularjs,data-binding
JSON is the way to go. I would look at libraries like Tastypie and Django REST framework to alleviate the amount of code to write.
0
0
0
0
2014-04-02T19:05:00.000
2
0
false
22,820,723
0
0
1
1
One of the features hawked by AngularJS aficionados is the two-way data binding between DOM contents and JavaScript data that the framework offers. I'm presently working on a couple of learning projects integrating AngularJS and Django, and one of the pain points is that the problem AngularJS solves between data in Jav...
Multiple websites using the same app - how to set this up?
22,856,740
2
1
60
0
django,python-2.7
I recently had something similar to do. I have for each domain a specific setting file with an unique SITE_ID and also a wsgi file per site. Then in my http.conf (I'm using apache on webfaction) i set up multiple VirtualHost instances, each pointing out to the specific wsgi file. My configuration looks something like t...
0
0
0
0
2014-04-04T03:14:00.000
2
1.2
true
22,852,845
0
0
1
1
I have an app that shows products available in the US. If i want to change the country, I simply modify the value of a variable in my settings.py file. Now... each country I serve needs to have its own site, e.g. example.co.uk, example.ca, etc. They'll all be hosted on the same server and use the same database. The vie...
Security optimal file permissions django+apache+mod_wsgi
24,634,526
1
4
1,003
1
python,django,apache,security,permissions
In regards to serving the application from your home directory, this is primarily preference based. However, deployment decisions may be made depending on the situation. For example, if you have multiple users making use of this server to host their website, then you would likely have the files served from their home d...
0
0
0
0
2014-04-04T20:58:00.000
1
0.197375
false
22,872,888
0
0
1
1
I'm just about getting started on deploying my first live Django website, and I'm wondering how to set the Ubuntu server file permissions in the optimal way for security, whilst still granting the permissions required. Firstly a question of directories: I'm currently storing the site in ~/www/mysite.com/{Django apps}, ...
pydev Google App run Path for project must have only one segment
23,118,828
8
4
1,009
0
eclipse,google-app-engine,python-2.7
This is clearly a bug, but there's a possible workaround: In a .py file in your project, right-click and go to "Run As." Then, select "Python Run" (not a custom configuration). Let it run and crash or whatever this particular module does. Now, go look at your run configurations - you'll see one for this run. You ca...
0
1
0
0
2014-04-05T05:40:00.000
1
1.2
true
22,877,052
0
0
1
1
I had trouble to run the pyDev Google App run on Eclipse. I can't create a new run configuration and I get this error message: Path for project must have only one segment. Any ideas about how to fix it? I am running Eclipse Kepler on Ubuntu 13.10
Find Imported Python Modules
22,879,658
1
1
67
0
python,flask
You can use sys.modules.keys() but you will need to import sys to use it.
0
0
0
0
2014-04-05T10:24:00.000
3
1.2
true
22,879,593
1
0
1
1
I'm building a flask application and I want to remove the redundancy on importing modules. So, on runtime I want to print all the imported modules. Is there a way to do that?
Exchanging NDB Entities between two GAE web apps using URL Fetch
22,880,568
2
0
131
0
python,google-app-engine,google-cloud-datastore,app-engine-ndb,urlfetch
You can use the NDB to_dict() method for an entity and use json to exchange te data. If it is a lot of data you can use a cursor. To exchange the entity keys, you can add the safe key to the dict.
0
1
0
0
2014-04-05T10:53:00.000
2
0.197375
false
22,879,890
0
0
1
1
I am planning to exchange NDB Entities between two GAE web apps using URL Fetch. One Web app can initiate the HTTP POST Request with the entity model name, starting entity index number and number of entities to be fetched. Each entity would have an index number which would be incremented sequentially for new entities...
Clean retry in deferred.defer
22,900,378
0
0
165
0
python,google-app-engine
Just relaunch the task from the task with another deferred.defer call.
0
1
0
0
2014-04-06T21:04:00.000
2
0
false
22,900,026
0
0
1
2
I am using deferred.defer quite heavily to schedule tasks using push queues on AppEngine. Sometimes I wish I would have a clean way to signal a retry for a task without having to raise an Exception that generates a log warning. Is there a way to do this?
Clean retry in deferred.defer
22,905,035
4
0
165
0
python,google-app-engine
If you raise a deferred.SingularTaskFailure it will set an error HTTP-status, but there won't be an exception in the log.
0
1
0
0
2014-04-06T21:04:00.000
2
1.2
true
22,900,026
0
0
1
2
I am using deferred.defer quite heavily to schedule tasks using push queues on AppEngine. Sometimes I wish I would have a clean way to signal a retry for a task without having to raise an Exception that generates a log warning. Is there a way to do this?
Django request.POST.get SQL injection
22,902,662
1
1
784
0
python,django
If you're feeding the result of request.POST right into a SQL query (i.e., without using the Django ORM), you will most definitely be vulnerable to SQL injection. But, if you are using the Django ORM (or another well-written ORM, such as SQLAlchemy), all of your input data will be sanitized. tldr; you're safe
0
0
0
0
2014-04-07T02:22:00.000
1
1.2
true
22,902,616
0
0
1
1
I'm currently getting POST data using the method request.POST.get(). I'd like to know if this method gives me raw POST data or if it's correctly escaping and protected against SQL injection. Thank you in advance for your help. Galaf
Reading Javascript Variable in Python
22,907,980
1
1
672
0
javascript,python,parameter-passing
I'm trying to code my bot in Python, then, since it can run synchronously with the browser. How can I pass the JavaScript variables to a client-side Python program?... You can pass the JavaScript variables only with query string. I create the server in CherryPy (CherryPy is an object-oriented web application framework...
0
0
1
0
2014-04-07T04:29:00.000
1
0.197375
false
22,903,625
1
0
1
1
I'm trying to create a bot for an online game. The values for the game are stored in Javascript variables, which I can access. However, running my bot code in Javascript freezes the browser, since my code is the only thing that executes. I'm trying to code my bot in Python, then, since it can run synchronously with th...
If I install Django CMS will it still show my current work in Django admin
22,915,407
0
0
34
0
python,django
The Django CMS is a totally different environment. You can't install it on top of your current project. So if you want your models inside django cms you have to migrate them manually to the new enviroment. Maybe their are solutions for it but I'm not aware of them.
0
0
0
0
2014-04-07T12:56:00.000
1
1.2
true
22,913,080
0
0
1
1
I'm totally new to Python and I've been learning how to use Django and it's admin functionality to work with my models. My question really is how, if I were to install Django CMS, would work with the admin? My understanding it limited so I wanted to check as I'm struggling to know if it will still show the model's that...
django: Generic Views without Templates
22,943,192
1
0
1,412
0
python,django,oop
Templates need HTML. If you want to be generic I would Use a base template and then for each model and CRUD-Operation a partial That takes an object or list of objects and knows exactly how to render That model. The block notation also is good to arrange HTML content. However, to write an standardized interface like th...
0
0
0
0
2014-04-08T13:46:00.000
1
0.197375
false
22,939,011
0
0
1
1
AFAIK you need a template to use generic views in django. Is there a way or third party app to use generic views without HTML templates? I love the django admin interface, since you can use and configure it without writing HTML. I prefer the object oriented way which is used in django admin to customize it. In most cas...
Using Python to communicate with JavaScript?
22,950,323
0
0
645
0
javascript,python
For security reasons, javascript in a browser is usually restricted to only communicate with the site it was loaded from. Given that, that's an AJAX call, a very standard thing to do.
0
0
1
0
2014-04-08T23:41:00.000
3
0
false
22,950,275
0
0
1
1
Is there a way to send data packets from an active Python script to a webpage currently running JavaScript? The specific usage I'm looking for is to give the ability for the webpage, using JavaScript, to tell the Python script information about the current state of the webpage, then for the Python script to interpret t...
Storing user data in one big database or in a different file for each user - which is more efficient?
22,951,848
1
0
242
1
python,json,database,performance,security
I don't think efficiency should be part of your calculus. I don't like either of your proposed designs. One table? That's not normalized. I don't know what data you're talking about, but you should know about normalization. Multiple copies? That's not scalable. Every time you add a user you add a table? Sounds lik...
0
0
0
0
2014-04-09T02:39:00.000
1
0.197375
false
22,951,806
1
0
1
1
I'm trying to store user data for a website in Python I'm making. Which is more efficient: -Storing all the user data in one huge table -Storing all the user data in several tables, one per user, in one database. -Storing each user's data in a XML or JSON file, one file per user. Each file has a unique name based on ...
Is django.db.reset_queries required for a (nonweb) script that uses Django when DEBUG is False?
23,063,519
4
3
801
1
python,django,memory-leaks,daemon
After running a debugger, indeed, reset_queries() is required for a non-web python script that uses Django to make queries. For every query made in the while loop, I did find its string representation appended to ones of the queries list in connections.all(), even when DEBUG was set as False.
0
0
0
0
2014-04-10T01:25:00.000
1
1.2
true
22,976,981
0
0
1
1
I have a script running continuously (using a for loop and time.sleep). It performs queries on models after loading Django. Debug is set to False in Django settings. However, I have noticed that the process will eat more and more memory. Before my time.sleep(5), I have added a call to django.db.reset_queries(). The ver...
Plone store form inputs in a lightweight way
22,986,589
0
2
153
1
python,forms,plone
One approach is to create a browser view that accepts and retrieves JSON data and then just do all of the form handling in custom HTML. The JSON could be stored in an annotation against the site root, or you could create a simple content type with a single field for holding the JSON and create one per record. You'll ne...
0
0
0
0
2014-04-10T10:33:00.000
3
0
false
22,985,483
0
0
1
1
I need to store anonymous form data (string, checkbox, FileUpload,...) for a Conference registration site, but ATContentTypes seems to me a little bit oversized. Is there a lightweight alternative to save the inputs - SQL and PloneFormGen are not an option I need to list, view and edit the data inputs in the backend.....
How to add many to one relationship with model from external application in django
22,990,016
1
5
564
0
python,django,foreign-key-relationship
There are (at least) two ways to accomplish it: More elegant solution: Use a TicketProfile class which has a one-to-one relation to Ticket, and put the Client foreign key into it. Hacky solution: Use a many-to-many relation, and manually edit the automatically created table and make ticket_id unique.
0
0
0
0
2014-04-10T13:38:00.000
2
0.099668
false
22,989,689
0
0
1
1
My django project uses django-helpdesk app. This app has Ticket model. My app got a Client model, which should have one to many relationship with ticket- so I could for example list all tickets concerning specific client. Normally I would add models.ForeignKey(Client) to Ticket But it's an external app and I don't wan...
mod_wsgi Error on CentOS 6.5
23,104,951
1
0
1,164
1
python,linux,apache,mod-wsgi
I think I figured the out. I needed to load the module and define the VirtualHost in the same include file. I was trying to load in the first include file and define the VirtualHost in the second. Putting them both in one file kept the error from happening.
0
0
0
0
2014-04-10T15:48:00.000
1
0.197375
false
22,992,857
0
0
1
1
folks. I'm very new to coding and Python. This is my second Stack question ever. Apologies if I'm missing the obvious. But, I've researched this and am still stuck. I've been trying to install and use mod_wsgi on CentOS 6.5 and am getting an error when trying to add a VirtualHost to Apache. The mod_wsgi install seemed ...
How to run multiple spiders in the same process in Scrapy
22,997,392
4
3
2,104
0
python,python-2.7,scrapy
You will have a name for every spider in the file that says name="youspidername". and when you call it using scrapy crawl yourspidername, it will crawl only that spider. you will have to again give a command to run the other spider using scrapy crawl youotherspidername. The other way is to just mention all the spiders ...
0
0
0
0
2014-04-10T18:09:00.000
3
0.26052
false
22,995,746
0
0
1
1
I'm beginner in Python & Scrapy. I've just create a Scrapy project with multiple spiders, when running "scrapy crawl .." it runs only the first spider. How can I run all spiders in the same process? Thanks in advance.
Easiest way to store a single timestamp in appengine
23,025,323
0
0
651
0
python,google-app-engine
Another way to solve this, that i found, is to use memcache. It's super easy. Though it should probably be noted that memcache could be cleared at anytime, so NDB is probably a better solution. Set the timestamp: memcache.set("timestamp", current_timestamp) Then, to read the timestamp: memcache.get("timestamp")
0
1
0
0
2014-04-10T23:36:00.000
2
0
false
23,000,998
0
0
1
1
I am running a Python script on Google's AppEngine. The python script is very basic. Every time the script runs i need it to update a timestamp SOMEWHERE so i can record and keep track of when the script last ran. This will allow me to do logic based on when the last time the script ran, etc. At the end of the script i...
Pass username/password (Formdata) in a scrapy shell
23,269,542
0
1
407
0
python,web-scraping,scrapy
one workaround is to first login using scrapy (using FormRequest) and then invoke inspect_response(response) in the parse method
0
0
1
0
2014-04-11T21:59:00.000
1
0
false
23,023,294
0
0
1
1
Is there a way to pass formdata in a scrapy shell? I am trying to scrape data from an authenticated session, and it would be nice to check xpaths and so on through a scrapy shell.
Adding private messaging to a Django project
23,041,136
1
0
225
0
python,django
I guess you'll have to roll your own, but really doesn't sound hard. Is there a reason you'd like to do it in Django? Django is not a simple CMS that you just install and enable some features to make it work. It's a framework, which means you'll have to do some things yourself. And doing this yourself, if you're at lea...
0
0
0
0
2014-04-13T09:22:00.000
1
1.2
true
23,040,983
0
0
1
1
I'm trying to develop an HTML app with Django using python 3.3.3, and was wondering if there was a simple way to implement a user - to - user private messaging system. I've searched for preexisting apps, but most are out of active development, and other online answers were mostly not useful at all. If possible, I would...
clone element with beautifulsoup
27,881,018
8
21
10,039
0
python,beautifulsoup
It may not be the fastest solution, but it is short and seems to work... clonedtag = BeautifulSoup(str(sourcetag)).body.contents[0] BeautifulSoup creates an extra <html><body>...</body></html> around the cloned tag (in order to make the "soup" a sane html document). .body.contents[0] removes those wrapping tags. This i...
0
0
1
0
2014-04-14T10:21:00.000
3
1
false
23,057,631
0
0
1
1
I have to copy a part of one document to another, but I don't want to modify the document I copy from. If I use .extract() it removes the element from the tree. If I just append selected element like document2.append(document1.tag) it still removes the element from document1. As I use real files I can just not save doc...
How to change a sqlite table column value type from Django model?
49,475,275
0
1
1,433
0
python,django,sqlite
There is an easy way to do this. (in Django 2) After making the necessary changes to the model.py file of your app, run command: python manage.py makemigrations - This will generate a new file in migration folder of your app. python manage.py migrate - This will apply those edits on actual databse. To check if the ch...
0
0
0
0
2014-04-15T12:21:00.000
2
0
false
23,083,599
0
0
1
1
I created a table before I code the Django app and now I merged both the app and the table with following command python manage.py inspectdb > models.py. However after some while I really need to change the value type of one of the column. Is it enough to chage it through the model file or do I need some additional ste...
What is best way to save data with appengine/HTML5/JavaScript/Python combo?
23,128,324
0
0
133
0
javascript,html,google-app-engine,python-2.7
My thanks to all of you for taking time to respond. Each response was useful it it's own way. The AJAX/JQuery looks a promising route for me, so many thanks for the link on that. I'll stop equivocating and stick with Python rather than try Go and start working through the tutorials and courses. Gary
0
1
0
0
2014-04-15T13:42:00.000
4
0
false
23,085,522
0
0
1
1
I want to build an application with an HTML5 interface that persists data using google-app-engine and could do with some some advice to avoid spending a ton of time going down the wrong path. What is puzzling me is the interaction between HTML5, Javascript/JQuery and Python. Let's say, I have designed an HTML5 site. I ...
Pass information between requests webapp2
23,091,888
1
0
345
0
python,google-app-engine,webapp2
You can do it in many ways. Set cookie by first response and it will be passed to next request - unsafe even cookie is crypted but can be. First GET will send author to second POST page - POST will send author (hidden field). First GET will send author to POST url as param (same as above). You will create session id a...
0
0
0
0
2014-04-15T15:19:00.000
2
0.099668
false
23,087,949
0
0
1
1
Is it possible to pass information between requests with webapp2? I have a class that has to set the author variable on HTTP GET. The HTTP POST will check if author exists, and then continue posting. I tried by having a global variable author=None and then setting author in the HTTP GET, but I think the object is destr...
How do I break down files in a similar way to torrents?
25,778,457
0
0
350
0
python,bittorrent
It's trivial to "break down" files as you put it. You'll need an algorithm to disassemble them, and then to reassemble them later, presumably by a browser since you mentioned HTML and CSS. Bittorrents implements this, and additionally the ability upload and download from a distributed "swarm" of peers also interested i...
0
0
0
0
2014-04-15T23:59:00.000
1
0
false
23,096,631
0
0
1
1
I am trying to make a program that breaks down files like HTML or CSS into chunks like that of a torrent. I am completely unsure how to do this. They need to be broken down, than later reassembled in order. anybody know how to do this? It doesn't have to be in Python, that was just my starting point.
Google Analytics reports API - Insufficient Permission 403
29,837,598
0
3
5,740
0
python,django,python-2.7,google-analytics-api,http-status-code-403
You should use View ID Not account ID, the 'View ID', you can go: Admin -> Select Site -> Under "View" -> View Settings , if it doesn't works you can go: Admin->Profiles->Profile Settings
0
0
1
0
2014-04-17T09:07:00.000
3
0
false
23,128,964
0
0
1
2
I am trying to access data from google-analytics. I am following the guide and is able to gauthorize my user and get the code from oauth. When I try to access data from GA I only get 403 Insufficient Permission back. Do I somehow have to connect my project in Google API console to my analytics project? How would I do ...
Google Analytics reports API - Insufficient Permission 403
24,274,077
9
3
5,740
0
python,django,python-2.7,google-analytics-api,http-status-code-403
Had the same problem, but now is solved. Use View ID Not account ID, the 'View ID', can be found in the Admin->Profiles->Profile Settings tab UPDATE now, if you have more a account , you must go: Admin -> Select account -> under View-> click on View Settings
0
0
1
0
2014-04-17T09:07:00.000
3
1.2
true
23,128,964
0
0
1
2
I am trying to access data from google-analytics. I am following the guide and is able to gauthorize my user and get the code from oauth. When I try to access data from GA I only get 403 Insufficient Permission back. Do I somehow have to connect my project in Google API console to my analytics project? How would I do ...
Python logging with thread locals
23,138,661
1
2
989
0
python,django,logging,thread-local-storage
You can create a logging.Filter() object that grabs the thread-local variable (or a suitable default when its not there) and add it to the log record. Attach that filter to the root logger and it will be called for all log records before they are passed to handlers. Once the variable is in the log record it can be used...
0
0
0
0
2014-04-17T14:36:00.000
1
1.2
true
23,136,122
1
0
1
1
I'd like to prepend the user email to all web app logs. I can store the email (taken from the cookie and such) in threading.local(). But I can't be always sure the variable will be there in the thread locals. Is there a way to tell all the loggers in my app to act like that?
How Django framework works behind the scenes?
23,143,062
4
1
651
0
python,django,uwsgi,gunicorn,django-middleware
You don't say where your "understanding" comes from, but it's not really accurate. Django itself is pretty agnostic about how it runs - it depends on the server - but it's very unusual for it to be invoked from scratch on each request. About the only method where that's the case is CGI, and it'll run like a dog. Speaki...
0
0
0
0
2014-04-17T20:24:00.000
1
1.2
true
23,142,757
0
0
1
1
This might sound stupid question so apologies in advance. I am trying to understand how Django framework actually works behind the scenes. It's my understanding that Django does not run all the time and gets invoked by uwsgi/gunicorn or anything else when a request comes in and processed as follows: WsgiHandler or Mod...
google endpoint custom auth python
23,223,929
0
1
95
0
python,facebook,google-app-engine,authentication,google-cloud-endpoints
For request details, add 'HttpServletRequest' (java) to your API function parameter. For Google authentication, add 'User' (java) to your API function parameter and integrate with Google login on client. For twitter integration, use Google app-engine OpenID. For facebook/loginForm, its all on you to develop a custom au...
0
0
1
0
2014-04-18T12:26:00.000
1
1.2
true
23,154,120
0
0
1
1
I'm trying to implement a secure google cloud endpoint in python for multi-clients (js / ios / android) I want my users to be able to log by three ways loginForm / Google / Facebook. I read a lot of docummentation about that but I didn't realy understood how I have to handle connection flow and session (or something el...
How can I get all the plain text from a website with Scrapy?
50,809,934
1
23
27,552
0
python,html,xpath,web-scraping,scrapy
The xpath('//body//text()') doesn't always drive dipper into the nodes in your last used tag(in your case body.) If you type xpath('//body/node()/text()').extract() you will see the nodes which are in you html body. You can try xpath('//body/descendant::text()').
0
0
1
0
2014-04-18T15:03:00.000
3
0.066568
false
23,156,780
0
0
1
1
I would like to have all the text visible from a website, after the HTML is rendered. I'm working in Python with Scrapy framework. With xpath('//body//text()') I'm able to get it, but with the HTML tags, and I only want the text. Any solution for this?
Make python script to run forever on Amazon EC2
23,166,196
17
13
8,060
0
python,amazon-web-services,ssh,amazon-ec2
You can run the program using the nohup command, so that even when the SSH session closes your program continues running. Eg: nohup python yourscriptname.py & For more info you can check the man page for it using man nohup.
0
1
0
1
2014-04-19T05:16:00.000
2
1
false
23,166,158
0
0
1
1
I have a python script that basically runs forever and checks a webpage every second and notifies me if any value changes. I placed it on an AWS EC2 instance and ran it through ssh. The script was running fine when I checked after half an hour or so after I started it. The problem is that after a few hours when I chec...
Automatic SignOut in OpenERP 7 during System Shutdown
23,171,711
-1
0
183
0
python,windows,openerp,openerp-7
Can we make it in such way that when we Shutdown the System it should SignOut Automatically without the User interference there is no need to logoff the users. HTTP is a transactional protocol. All is done when the client has made any request. After any client request the system is always in a clean state. There is ...
0
1
0
0
2014-04-19T05:41:00.000
1
-0.197375
false
23,166,349
0
0
1
1
To SignIn/SignOut into OpenERP 7 we have to login into OpenERP and click on the Icon which is on the right top just beside the "Compose New Message" Icon. Now most of the users forget to SignOut from ERP. Can we make it in such way that when we Shutdown the System it should SignOut Automatically without the User inter...
Issue with PyCharm and RubyMine, JRE folder?
23,365,722
1
1
200
0
java,python,ruby,pycharm,rubymine
IDE comes with it's own version of JRE on Windows. You can easily configure your environment to use your system wide or any custom JRE (and then delete bundled one if so desired). Just check .bat file in INSTALL_FOLDER\bin folder and see what environment variables and in what order it uses when searching for JRE. By o...
0
0
0
0
2014-04-20T11:44:00.000
1
1.2
true
23,181,615
1
0
1
1
The PyCharm and RubyMine IDE's comes with a folder named JRE in the root installation dir, the JRE folder increments the size of the installation around 150 MB, well, I supposse that this folder just contains exactlly the same java runtime environment that an official JRE installer downloaded from Java.com installs, so...
How do I get xhtml2pdf working on GAE?
23,335,617
0
0
113
0
python,google-app-engine,app.yaml,xhtml2pdf
I got it now! Don't use XHTML2PDF - use ReportLab on its own instead.
0
1
0
0
2014-04-20T16:17:00.000
1
0
false
23,184,702
0
0
1
1
I am new to GAE, web dev and python, but am working my way up. I have been trying to get xhtml2pdf working on GAE for some time now but have had no luck. I have downloaded various packages but keep getting errors of missing modules. These errors vary depending on what versions of these packages and dependencies I use...
django-tables2 'module' object has no attribute 'LinkColumn'
67,400,201
1
0
1,133
0
django,python-2.7,django-tables2
You can use tables.columns.LinkColumn instead of tables.LinkColumn. I solved my problem this way.
0
0
0
0
2014-04-21T02:08:00.000
1
0.197375
false
23,189,794
0
0
1
1
I have this problem when using django-tables2 and a custom template rendering. The issue arises when I added another column, one that is not specified in the model, and the error AttributeError: 'module' object has no attribute 'LinkColumn' pops up. The table and the custom rendering worked when just the model columns ...
How to check if Django 1.3 project is also compatible with Django 1.6
23,219,502
5
1
66
0
python,django,compatibility
The best way is to build a virtualenv with Django 1.6, install your app, and run its tests. There will likely be some small breaks—Django has changed since 1.3—but they should be relatively easy to patch up.
0
0
0
0
2014-04-22T12:22:00.000
1
1.2
true
23,219,456
0
0
1
1
I working on project where I must use things from an existing Django application. The application is written with Django 1.3. Is there a way to determine if it is possible to use it for a project that use in Django 1.6.
No distributions at all found for some package
23,223,408
8
26
83,294
0
python,django
I got the solution ,Try with --allow-unverified syntax: pip install packagename=version --allow-unverified packagename Some package condains insecure and unverifiable files. it will not download to the system . and it can be solved by using this method --allow-unverified. it will allow the installation. Eg: pip in...
0
0
0
0
2014-04-22T14:14:00.000
9
1.2
true
23,222,104
0
0
1
1
error when installing some package but its actualy existing example django-ajax-filtered-fields==0.5 Downloading/unpacking django-ajax-filtered-fields==0.5 (from -r requirements.example.pip (line 13)) Could not find any downloads that satisfy the requirement django-ajax-filtered-fields==0.5(from -r requiremen...
Flash content not loading using headless selenium on server
23,436,481
0
0
574
0
python,selenium,flash
It turns out, I needed to use selenium to scroll down the page to load all the content.
0
0
1
0
2014-04-22T18:41:00.000
1
1.2
true
23,227,680
0
0
1
1
I am running selenium webdriver (firefox) using python on a headless server. I am using pyvirtualdisplay to start and stop the Xvnc display to grab the image of the sites I am visiting. This is working great except flash content is not loading on the pages (I can tell because I am taking screenshots of the pages and ...
How to override Django model creation without affecting update?
23,249,113
3
2
24
0
python,django
You should not override __init__, because that is called in all cases when a model is being instantiated, including when you load it from the database. A good way to do what you want is to check the value of self.pk within your save method: if it is None, then this is a new instance being created.
0
0
0
0
2014-04-23T15:24:00.000
1
1.2
true
23,248,765
0
0
1
1
I overrided the save() method of my Fooclass so that when I create a Foo instance, some logic occurs. It works well. Nevertheless, I have other methods in other classes that update Foo instances, and of course, I have to save changes calling the save() method. But I want them to directly update without passing into the...