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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Python / Django | How to store sent emails? | 30,368,302 | 5 | 3 | 559 | 0 | python,django | I think the easiest way before messing up with middleware or whatever is to simply create a model for your logged emails and add a new record if send was successful. | 0 | 0 | 0 | 1 | 2015-05-21T08:22:00.000 | 3 | 1.2 | true | 30,368,271 | 0 | 0 | 1 | 2 | I was wondering how can I store sent emails
I have a send_email() function in a pre_save() and now I want to store the emails that have been sent so that I can check when an email was sent and if it was sent at all. |
How to do django syncdb in version 1.4.2? | 30,392,918 | 3 | 1 | 2,775 | 1 | python,django,django-models,django-syncdb | Thanks Amyth for the hints.
btw the commands is a bit different, i will post a 10x tested result here.
Using south
1. setup the model
python manage.py schemamigration models --initial
dump data if you have to
python manage.py dumpdata -e contenttypes -e auth.Permission --natural > data.json
syncdb
python manage.... | 0 | 0 | 0 | 0 | 2015-05-22T03:38:00.000 | 2 | 1.2 | true | 30,387,974 | 0 | 0 | 1 | 1 | How to do syncdb in django 1.4.2?
i.e. having data in database, how to load the models again when the data schema is updated?
Thanks in advance |
Django project - serve one of the apps on different domain | 30,391,339 | 3 | 1 | 1,601 | 0 | python,django,django-views,django-urls | You could run each each domain site independently using their own settings.
This way you can control how much they share using the same codebase.
Create separate settings for both sites. Where each of the settings specify a different ROOT_URLCONF and any extra setting required such as ALLOWED_HOSTS.
Create two separa... | 0 | 0 | 0 | 0 | 2015-05-22T07:45:00.000 | 2 | 0.291313 | false | 30,391,105 | 0 | 0 | 1 | 1 | I have django project with consist of multiple apps.
One app contains all core functions and code (common models etc). I serve it on one domain.
Now I want to add new app which will use some of the other app's models BUT all URLS of this app should be served on different domain.
Is it possible? |
Future migration of djangos permission system | 30,767,919 | 0 | 0 | 22 | 0 | python,django | From your description, you will need to use (something like) django-guardian.
Default Django permissions only apply to models(/tables). You cannot give someone permission to edit a specific article, category, comment or tag (only all articles, all categories, etc). | 0 | 0 | 0 | 0 | 2015-05-22T20:25:00.000 | 1 | 0 | false | 30,405,350 | 0 | 0 | 1 | 1 | I'm starting to use django and read a lot of documentation in the last days. I also read about the permission system as well as about other systems like django guardian package. I'm trying to implement a multi-user blogging system and I'm not sure if I shall use django permissions or something else, like django guardia... |
Pyenv choose virtualenv directory | 36,550,830 | 12 | 16 | 12,162 | 0 | python-3.x,virtualenv,pyenv | Short answer: You can’t, as far as I know.
It wouldn’t really work either, right? If you use pyenv virtualenv to install a virtualenv into a repo, and you clone that repo to another machine… how would pyenv on the new machine know to take control of the virtualenv in the repository?
Also, “you probably shouldn’t do t... | 0 | 0 | 0 | 0 | 2015-05-22T23:54:00.000 | 4 | 1.2 | true | 30,407,446 | 1 | 0 | 1 | 1 | I just began to use pyenv to manage my python versions, and began to use the pyenv virtualenv plugin to manage my virtualenvs, and so far, I have loved it. One thing I miss however, is that with virtualenv, you could actually place virtual environments in repository directories so that your repository was a completely ... |
When are create and update called in djangorestframework serializer? | 30,409,455 | 20 | 33 | 20,210 | 0 | python,django,django-rest-framework | I finally understand how the .create() and .update() work in Serializer (especially ModelSerializer) and how they are connected to Viewsets (especially ModelViewSet). I just want clarify the concept more clearly if someone comes to this question.
Basically, the 4 methods CRUD in ModelViewSet: .create(), .retrieve(), .u... | 0 | 0 | 0 | 0 | 2015-05-23T05:05:00.000 | 3 | 1 | false | 30,409,076 | 0 | 0 | 1 | 1 | I'm currently implementing djangorestframework for my app RESTful API. After playing around with it, I still do not clearly understand what .create(self, validated_data) and .update(self, validated_data) used for in the serializer. As I understand, CRUD only calls the 4 main methods in viewsets.ModelViewSet: create(), ... |
Debugging ANT script initiated via a Python script | 30,913,800 | 0 | 0 | 112 | 0 | python,eclipse,debugging,ant,pydev | When dealing with multiple languages, the way for debugging is regular debugging in one and remote debugging in the other... I'm guessing the ant debug uses the regular java debug which supports remote debugging, so, you can probably try that (although I haven't tried it here to confirm). | 0 | 1 | 0 | 1 | 2015-05-23T12:06:00.000 | 1 | 0 | false | 30,412,458 | 0 | 0 | 1 | 1 | I have a set of Python scripts that sets up various parameters/properties for ANT script based on various conditions that are checked in the Python scripts and then invokes/executes the appropriate ANT build script.
I initiate the Python script from my Eclipse IDE. I have the PyDev plug-in installed in Eclipse.
I am ab... |
What is the difference between creating db tables using alembic and defining models in SQLAlchemy? | 30,425,438 | 52 | 19 | 10,088 | 1 | python,flask,sqlalchemy,alembic | Yes, you are thinking about it in the wrong way.
Let's say you don't use Alembic or any other migration framework. In that case you create a new database for your application with the following steps:
Write your model classes
Create and configure a brand new database
Run db.create_all(), which looks at your models and... | 0 | 0 | 0 | 0 | 2015-05-24T15:30:00.000 | 2 | 1.2 | true | 30,425,214 | 0 | 0 | 1 | 1 | I could create tables using the command alembic revision -m 'table_name' and then defining the versions and migrate using alembic upgrade head.
Also, I could create tables in a database by defining a class in models.py (SQLAlchemy).
What is the difference between the two? I'm very confused. Have I messed up the concep... |
Email API for connecting in a marketplace? | 30,427,829 | 0 | 0 | 74 | 0 | javascript,php,python,email | What you're describing would be handled largely by your backend. If this were my project, I would choose the following simple route:
Store the messages the buyers/sellers send in your own database, then simply send notification emails when messages are sent. Have them reply to each other on your own site, like Faceboo... | 0 | 0 | 1 | 1 | 2015-05-24T19:12:00.000 | 1 | 0 | false | 30,427,300 | 0 | 0 | 1 | 1 | I'm looking into what it would take to add a feature to my site so this is a pretty naive question.
I'd like to be able to connect buyers and sellers via an email message once the buyer clicks "buy".
I can see how I could do this in java script, querying the user database and sending an email with both parties involv... |
How to get Facebook posts of same type grouped into one, separately? | 30,502,981 | 1 | 0 | 67 | 0 | python,facebook,facebook-graph-api | Facebook aggregates all your friend birthday posts in a single post. Once the posts are aggregated there is no way to retrieve the individual post as they don't longer exist. | 0 | 0 | 1 | 0 | 2015-05-24T22:43:00.000 | 1 | 1.2 | true | 30,429,084 | 0 | 0 | 1 | 1 | I'm using Facebook Graph API to get all the posts on my own timeline.
There is a problem. Because it was my birthday yesterday and all of the posts were done on my profile by others(my friends), these posts are shown as clubbed into one.
This is the response I get in one of the posts when I make an API call at /v2.1/me... |
Django model for datetime availability | 30,434,626 | 1 | 0 | 1,007 | 0 | python,django | On the item's model, add two datetime fields, for example "bookedStart" and "bookedEnd". And have a function isBooked() that checks if a given datetime or the current datetime is in that time frame, and return True if it is, or False otherwise.
If the users should be able to add multiple time frames (at once) when an i... | 0 | 0 | 0 | 0 | 2015-05-25T08:39:00.000 | 2 | 0.099668 | false | 30,434,228 | 0 | 0 | 1 | 1 | I'm developing a sample application to book items from other users. I have hit a road block as I can't seem to figure out how to model when item is available to be rented.
Requirements:
Users can rent item per day or per hour.
Owner is able to select dates, hour an item is available.
Any ideas? |
can one spider handle multiple items and multiple pipelines? | 30,448,526 | 1 | 1 | 722 | 0 | python,web,scrapy | Item refers to an item of data that it's scraped. You can also call it a record or an entry.
Spider is the thing that does crawling (starting requests and following links) and scraping (extracting data items from responses). They can schedule whatever amount of requests and extract whatever amount of items as you want,... | 0 | 0 | 0 | 0 | 2015-05-26T01:20:00.000 | 1 | 0.197375 | false | 30,448,027 | 0 | 0 | 1 | 1 | New to scrapy.There are something confused me:what's the relationship between spiders,pipelines and items?
1.should one pipeline handle only one specific item or it can handle multiple items?
2.how to use one spider to crawl multiple items or I should use one spider just to crawl one item? |
importing Twilio on google app engine | 30,514,752 | 0 | 0 | 275 | 0 | python,google-app-engine,twilio | Thanks for the input. I had already tried all of these things. When I ran the app on a local host I saw in the console that the error I was facing was with 'pytz'
Turns out that Twilio requires the Pytz dependency to be in the root directory of Google App Engine. They have not updated the documentation yet.
Hope that... | 0 | 1 | 0 | 1 | 2015-05-27T09:39:00.000 | 3 | 1.2 | true | 30,478,647 | 0 | 0 | 1 | 1 | I've seen other similar questions but none of the solutions are working for me. I am trying to get Twilio working with Google App Engine. I am using the python API and can't seem to get it to work. I tried a few tactics:
used pip install twilio
downloaded the twilio file directly into my root directory
sym linked the... |
CSRF verification fails when trying to login in an already logged in application Django | 30,481,509 | 5 | 7 | 1,581 | 0 | python,django | This is to be expected. The login operation rotates the CSRF token, otherwise it would be possible to use the token from outside the authenticated session.
Hence what happens in your case:
Retrieve login page in Tab 1 (with unauthenticated "form" CSRF token)
Retrieve login page in Tab 2 (with unauthenticated "form" CS... | 0 | 0 | 0 | 0 | 2015-05-27T11:34:00.000 | 2 | 0.462117 | false | 30,481,279 | 0 | 0 | 1 | 1 | Here is what I did:
I have two tabs open on my browser, and I have the login form loaded in both the tabs.
I login with the required credentials on first tab.
I again try to login by providing the credentials on the second tab.
I get an error on the second tab : CSRF verification failed. Request aborted.
I have used ... |
How to connect a Machine Learning classifier to a Web App? | 30,491,984 | 2 | 2 | 1,275 | 0 | python,node.js,machine-learning,sentiment-analysis | Flask is a relatively simple web framework. It will suit your need to get the user-submitted text into a python function, without too much boilerplate code or complexity. There are alternatives, most notably Tornado.
I do wonder why you would stack two REST interfaces on top of eachother. Do you need the node.js applic... | 0 | 0 | 0 | 0 | 2015-05-27T19:31:00.000 | 2 | 0.197375 | false | 30,491,507 | 0 | 0 | 1 | 1 | I'm trying to build a sentiment classifier web app, but I don't understand who to connect the machine learning component with the web app. I've built the client-side web app that's running on a NodeJS server, and I've trained a sentiment classifier that saved as a Python script.
My goal is to have users submit text on ... |
Django 1.8, Using Admin app as the main site | 30,493,396 | 3 | 0 | 165 | 0 | python,django | This seems like a bad idea.
Out of the box, the information architecture presented by the admin interface is going to be very flat where views essentially mirror what's in the database 1:1. I can imagine a slim subset of users in internal IT apps or similar where that may be appropriate but the compromises in usability... | 0 | 0 | 0 | 0 | 2015-05-27T21:16:00.000 | 2 | 1.2 | true | 30,493,289 | 0 | 0 | 1 | 1 | I am about to begin work on a project that will use Django to create a system with three tiers of users. Each user will login into the dashboard type interface (each user will have different types of tools on the dashboard). There will be a few CRUD type interfaces for each user tier among other things. Only users with... |
Django 1.8, Multiple Custom User Types | 60,831,884 | 0 | 22 | 14,610 | 0 | python,django,authentication | You should need just use Groups Django mechanism - you need to create four groups like userA and let say common and check whether user is in first or second group - then show him appropriate view | 0 | 0 | 0 | 0 | 2015-05-28T01:59:00.000 | 2 | 0 | false | 30,495,979 | 0 | 0 | 1 | 1 | I am creating a Django site that will have 4 types of users;
Super Admin: Essentially manages all types of users
UserTypeA: Can login to site and basically will have a CRUD interface for some arbitrary model. Also has extra attributes (specific info that only pertains to TypeA users)
UserTypeB: Can login to site a... |
How to clear history and run all migrations from the beginning? | 62,187,440 | 2 | 4 | 7,131 | 0 | python,migration,alembic | Alembic is keeping track of the migrations in the alembic_version table on your database.
Simple drop the table to start from scratch using the following command:
DROP TABLE alembic_version;
And then try to run your migration again! | 0 | 0 | 0 | 0 | 2015-05-28T13:23:00.000 | 4 | 0.099668 | false | 30,507,853 | 0 | 0 | 1 | 1 | How I can clear history using alembic? I couldn't find this option in alembic history. I want to run from the first migration rather than the last applied. |
django models request get id error Room matching query does not exist | 30,517,111 | 3 | 1 | 1,484 | 1 | django,python-3.x,django-queryset,models | You are looking into request.POST, even if the request.method is not equal to 'POST'. This will not work, because when the request is not an HTTP-post, the POST-member of your request is empty. | 0 | 0 | 0 | 0 | 2015-05-28T20:59:00.000 | 3 | 0.197375 | false | 30,517,002 | 0 | 0 | 1 | 1 | i have two models, when i do request.POST.get('room_id') or ('id') i'm getting an error Room matching query does not exist.
how to solved this problem? help me
class Room(models.Model):
status = models.BooleanField('Status',default=True)
name = models.CharField('Name', max_length=100, unique=True... |
Inconsistently slow queries in production (RDS) | 30,519,353 | 0 | 0 | 1,181 | 1 | python,postgresql,amazon-rds,gevent | You could try this from within psql to get more details on query timing
EXPLAIN sql_statement
Also turn on more database logging. mysql has slow query analysis, maybe PostgreSQL has an equivalent. | 0 | 0 | 0 | 0 | 2015-05-29T00:34:00.000 | 2 | 0 | false | 30,519,299 | 0 | 0 | 1 | 1 | First, the server setup:
nginx frontend to the world
gunicorn running a Flask app with gevent workers
Postgres database, connection pooled in the app, running from Amazon RDS, connected with psycopg2 patched to work with gevent
The problem I'm encountering is inexplicably slow queries that are sometimes running on th... |
django-simple-history cannot import name error for model import in management command | 62,368,839 | 2 | 2 | 1,268 | 0 | python,django,python-2.7,django-models | To track history for a model and fix ur issues to use of this code.
pip install django-simple-history | 0 | 0 | 0 | 0 | 2015-05-29T09:52:00.000 | 1 | 0.379949 | false | 30,526,510 | 0 | 0 | 1 | 1 | I am using django-simple-history for maintaining the history for each model. Now when I import the model in my management command it gives
import error "cannot find import name 'ModelName'".
Any Help regarding this.? |
Running complex calculations (using python/pandas) in a Django server | 30,549,380 | 2 | 1 | 2,516 | 0 | python,django,python-2.7,numpy | I assume your question is about "how do I do these calculations in the restful framework for django?", but I think in this case you need to move away from that idea.
You did everything correctly but RESTful APIs serve resources -- basically your model.
A computation however is nothing like that. As I see it, you have t... | 0 | 0 | 0 | 0 | 2015-05-30T14:02:00.000 | 1 | 1.2 | true | 30,547,102 | 0 | 0 | 1 | 1 | I have developed a RESTful API using the Django-rest-framework in python. I developed the required models, serialised them, set up token authentication and all the other due diligence that goes along with it.
I also built a front-end using Angular, hosted on a different domain. I setup CORS modifications so I can acces... |
Deploy python web server on AWS Elastic Beanstalk | 30,565,453 | 2 | 1 | 284 | 0 | python,amazon-web-services,websocket,webserver,amazon-elastic-beanstalk | AWS doesn't "know" anything about your content. The webserver that you install will be configured to point to the "root" directory in which index.html (or something equivalent) should be.
Since it depends on which webserver (django, flask, Jinja etc) you install - you should lookup its documentation! | 0 | 0 | 0 | 0 | 2015-06-01T03:57:00.000 | 1 | 1.2 | true | 30,565,431 | 0 | 0 | 1 | 1 | I'm deploying an python web server on AWS now and I have a some question about it. I'm using websocket to communicate between back end and front end.
Do I have to use framework like django or flask?
If not, where should I put the index.html file? in other word, after deploying, how do AWS know the default page of my a... |
GAE - Share user authentication across apps | 30,570,660 | 1 | 0 | 51 | 0 | python,google-app-engine,flask,google-authentication,google-app-engine-python | You can't reuse the Users service authentication across different applications. A possible solution could be using a OAuth2 (or a similar mechanism) - create an application (or use one of you existing applications) which will be the authentication provider. Each application will redirect to the authentication provider ... | 0 | 1 | 0 | 0 | 2015-06-01T08:17:00.000 | 1 | 0.197375 | false | 30,568,702 | 0 | 0 | 1 | 1 | Let's say I run two different apps on different domains, coded in Python flask and running as GAE instances; one is site.co.uk and one is site.us.
If I use the GAE authentication on one site is it possible to have them authenticated for the other site too? I don't really want to make them have to authenticate for each ... |
Django how to not use cached queryset while iterating? | 30,579,869 | 1 | 0 | 49 | 0 | python,django,django-queryset | You can reload each object in the start of the loop body. Just use TheModel.objects.get(pk=curr_instance.pk) to do this. | 0 | 0 | 0 | 0 | 2015-06-01T13:53:00.000 | 1 | 1.2 | true | 30,575,409 | 0 | 0 | 1 | 1 | I have a queryset which I iterate through in a loop. I use data from the queryset to change data inside the queryset which might be needed in a lter step of the loop.
Now the queryset is only loaded once at the beginning of the loop. How can I make django reload the data in every iteration? |
How is a django app different from a python package? | 30,590,516 | 4 | 1 | 55 | 0 | python,django | Django app is actually a python package that follows the Django convention. Django-admin startapp is just a helper command to create the files in that convention. If you want to create an app without using startapp, then can create a folder and create __init__.py file and create the necessary files(for views and models... | 0 | 0 | 0 | 0 | 2015-06-02T07:36:00.000 | 2 | 1.2 | true | 30,590,085 | 1 | 0 | 1 | 2 | If I create a normal python package (with __init__.py), instead of manage.py startapp won't I still be able to use it like a django app.? |
How is a django app different from a python package? | 30,590,448 | 1 | 1 | 55 | 0 | python,django | Yes, you will be able to use it as a django app. Django is a web framework, hence its main aim is to allow their users to focus on their applications rather than to make them hard-code every single bit of information. | 0 | 0 | 0 | 0 | 2015-06-02T07:36:00.000 | 2 | 0.099668 | false | 30,590,085 | 1 | 0 | 1 | 2 | If I create a normal python package (with __init__.py), instead of manage.py startapp won't I still be able to use it like a django app.? |
How to add some external links to ROBOT Framework Test Statistics in log.html and output.xml? | 30,597,578 | 1 | 2 | 2,191 | 0 | python,robotframework | You want to add top-level metadata.
And that metadata would be an HTML link.
Create a suit setup for the master suite (create a file called __init__.robot in
the parent test folder)
And in it:
*** Settings ***
Documentation The main init phase for all robot framework tests.
Suite Setup Setup
*** Keywords ***
... | 0 | 0 | 0 | 0 | 2015-06-02T07:37:00.000 | 3 | 0.066568 | false | 30,590,100 | 0 | 0 | 1 | 1 | How can I customize my robot framework log.html and output so that I can add some external links to my output files like log.html and output.xml file. |
Can I link Django permissions to a model class instead of User instances? | 30,592,097 | 1 | 0 | 111 | 0 | python,django,database-design | django.contrib.auth has groups and group permissions, so all you have to do is to define landlords and tenants groups with the appropriate permissions then on your models's save() method (or using signals or else) add your Landlord and Tenant instances to their respective groups. | 0 | 0 | 0 | 0 | 2015-06-02T09:16:00.000 | 1 | 0.197375 | false | 30,591,965 | 0 | 0 | 1 | 1 | I know how permissions/groups/user work together in a "normal" way.
However, I feel incomfortable with this way to do in my case, let me explain why.
In my Django models, all my users are extended with models like "Landlord" or "Tenant".
Every landlord will have the same permissions, every tenant will have other same p... |
html buttons calling python functions using bottle | 30,595,791 | 3 | 1 | 617 | 0 | python,html,boto,bottle | What I have ended up doing to fix this issue is used bottle to make a url which completes the needed function. Then just made an html button that links to the relevant url. | 0 | 0 | 1 | 0 | 2015-06-02T09:36:00.000 | 1 | 0.53705 | false | 30,592,411 | 0 | 0 | 1 | 1 | I'm currently trying to right a python script that overnight turns off all of our EC2 instances then in the morning my QA team can go to a webpage and press a button to turn the instances back on.
I have written my python script that turns the severs off using boto. I also have a function which when ran turns them bac... |
How to import a 3rd party Python library into Bluemix? | 30,603,436 | 4 | 2 | 1,450 | 0 | python,ibm-cloud | The cause for this problem was that I was not correctly telling my Python app the needed configuration information when I pushed it out to Bluemix.
What I ended up having to do was add a requirements.txt file and a Procfile file into the root directory of my Python application, to draw that connection between my Python... | 0 | 0 | 0 | 0 | 2015-06-02T18:05:00.000 | 3 | 0.26052 | false | 30,603,407 | 0 | 0 | 1 | 1 | My Python app needs web.py to run but I'm unable to figure out how to get it up to bluemix. I see no options using cf push. I tried to "import web" and added some additional code to my app without success.
When I push my Python app to bluemix without web.py it fails (naturally) since it does not have what it needs to r... |
Python Embed Web Server in Data Processing Node | 32,857,200 | 0 | 0 | 124 | 0 | python,python-2.7,flask,tornado,bottle | I would recommend you use a separate process for your app that will receive REST commands (use Pyramid or Flask), and have it send messages over RabbitMQ to the real time part. I like Kombu myself for interfacing with RabbitMQ, and your message bus will nicely decouple your web/rest needs from your event driven needs. ... | 0 | 1 | 0 | 0 | 2015-06-03T04:28:00.000 | 1 | 0 | false | 30,610,850 | 0 | 0 | 1 | 1 | I am working on a Python 2.7 project with a simple event loop that checks a variety of data sources (rabbitmq, mongodb, postgres, etc) for new data, processes the data and writes data to the next stage.
I would like to embed a web server in the application so it can receive simple REST commands, for shutting it down,... |
Downsampling wav audio file | 65,321,335 | -1 | 24 | 66,340 | 0 | python,audio,wav,wave,downsampling | First, you need to import 'librosa' library
Use 'librosa.load' to resample the audio file
librosa.load(path,sr) initiallly sr(sampling rate) = 22050.If you want to preserve native sampling rate make sr=None. otherwise the audio will be resampled to the sampling rate provided | 0 | 0 | 0 | 0 | 2015-06-03T12:10:00.000 | 6 | -0.033321 | false | 30,619,740 | 0 | 0 | 1 | 1 | I have to downsample a wav file from 44100Hz to 16000Hz without using any external Python libraries, so preferably wave and/or audioop. I tried just changing the wav files framerate to 16000 by using setframerate function but that just slows down the entire recording. How can I just downsample the audio file to 16kHz a... |
What are the names of session ids for Python and Ruby? | 31,658,762 | 0 | 0 | 129 | 0 | python,ruby-on-rails,session | Sorry for the delay, I have the asnwer of my question:
I captured the HTTP traffic of some python and ruby on rails applications, the most common sessions ids for each language are the following:
-Python:
sessionid
-Ruby on Rails: The format of session id is: `
_{Name of application}_session
For example, for my "E... | 0 | 0 | 0 | 1 | 2015-06-03T16:29:00.000 | 1 | 1.2 | true | 30,625,748 | 0 | 0 | 1 | 1 | I want to know the names of session identifiers for Python and Ruby, for example, the names of session identifier for J2EE is JSESSIONID, for PHP is PHPSESSID.
Can you help me please? |
Changing css styles from view in Django | 30,631,241 | 1 | 4 | 6,764 | 0 | python,html,css,django | You can do this is many ways.
In general you need to return some variable from your view to the html and depending on this variable select a style sheet, if your variable name will match you style sheet's name you can do "{{variable}}.css", if not you can use JQuery. | 0 | 0 | 0 | 0 | 2015-06-03T21:25:00.000 | 3 | 0.066568 | false | 30,631,062 | 0 | 0 | 1 | 1 | Sorry in advance if there is an obvious answer to this, I'm still learning the ropes with Django.
I'm creating a website which has 6 pre determined subjects (not stored in DB)
english, civics, literature, language, history, bible
each subject is going to be associated with a unique color.
I've got a template for a subj... |
managed paypal accounts with least friction? | 30,634,280 | 2 | 0 | 47 | 0 | python,paypal,oauth,payment | PayPal doesn't have a way for people to sign up entirely through your site, although there are some ways to facilitate the process. You'd probably have to call PayPal to get access to some of those as they are aimed primarily at larger businesses.
However, don't neglect the easy/automatic assistance that PayPal gives y... | 0 | 0 | 0 | 1 | 2015-06-04T00:07:00.000 | 2 | 1.2 | true | 30,632,887 | 0 | 0 | 1 | 1 | I'd like to be able to pay the users of my site using PayPal Mass Payment. I think this is pretty straightforward if they have a PayPal account.
However, if they do not have a PayPal account, is there any way to have them sign up through my site, without leaving? Or just with a nice redirect? Whatever is least frictio... |
Serve dynamic data to many clients | 30,648,878 | 0 | 0 | 29 | 0 | python,vb.net | 1) I am not very familiar with Python, but for the .net application you will likely want to push change notifications to it, rather than pull. The system.net.webclient.downloadstring is a request (pull). As I am not a Python developer I cannot assist in that.
3) As you are requesting data, it is possible to create som... | 0 | 1 | 0 | 0 | 2015-06-04T15:24:00.000 | 1 | 0 | false | 30,647,952 | 1 | 0 | 1 | 1 | I am writing a client-server type application. The server side gathers constantly changing data from other hardware and then needs to pass it to multiple clients (say about 10) for display. The server data gathering program will be written in Python 3.4 and run on Debian. The clients will be built with VB Winforms o... |
Django: call index function on page reload | 30,649,463 | 1 | 0 | 519 | 0 | python,django,url-routing | Well, that really is not how it works. Each view is separate and is only called from the URLs that map to it. If you have shared code, you probably want to either factor it out into separate functions that you can call from each view, or use something like a template tag or context processor to add the relevant informa... | 0 | 0 | 0 | 0 | 2015-06-04T16:35:00.000 | 1 | 1.2 | true | 30,649,428 | 0 | 0 | 1 | 1 | I was wondering how to call my index(request) function thats in views.py upon every page reload. Currently index(request) only gets called when the app originally loads. Every other page reload after that calls another function in views.py called filter_report(request). The problem I am running into is that 85% of t... |
Subtract one date from another and get int | 30,669,335 | 0 | 0 | 171 | 0 | python,django | Take the difference between two dates, which is a timedelta, and ask for the days attribute of that timedelta. | 0 | 0 | 0 | 0 | 2015-06-05T14:36:00.000 | 1 | 0 | false | 30,669,269 | 1 | 0 | 1 | 1 | How can I subtract on datefield from another and get result in integer?
Like 11.05.2015-10.05.2015 will return 1
I tried
entry.start_devation= each.start_on_fact - timedelta(days=data.calendar_start) |
How to track Django model changes with git? | 30,669,779 | 1 | 1 | 216 | 0 | python,sql,django,git,workflow | You should track migrations. The only thing that you must keep an eye out for is at branch merge. If everyone uses a feature branch and develops on his branch then the changes are applied once the branch is integrated. At that point (pull request time or integration time) you need to make sure that the migrations make ... | 0 | 0 | 0 | 0 | 2015-06-05T14:51:00.000 | 4 | 0.049958 | false | 30,669,568 | 0 | 0 | 1 | 2 | Suppose you write a Django website and use git to manage the source code. Your website has various instances (one for each developer, at least).
When you perform a change on the model in a commit, everybody needs to update its own database. In some cases it is enough to run python manage.py migrate, in some other cases... |
How to track Django model changes with git? | 30,669,896 | 4 | 1 | 216 | 0 | python,sql,django,git,workflow | All changes to models should be in migrations. If you "need to run a few custom SQL queries and/or run some Python code to update values" then those are migrations too, and should be written in a migration file. | 0 | 0 | 0 | 0 | 2015-06-05T14:51:00.000 | 4 | 1.2 | true | 30,669,568 | 0 | 0 | 1 | 2 | Suppose you write a Django website and use git to manage the source code. Your website has various instances (one for each developer, at least).
When you perform a change on the model in a commit, everybody needs to update its own database. In some cases it is enough to run python manage.py migrate, in some other cases... |
Are there any known negatives to using Requests in Flask to interface to Cloudant on Bluemix? | 30,679,043 | 4 | 2 | 137 | 0 | python,flask,couchdb,ibm-cloud,cloudant | The main advantage of using a Cloudant/CouchDB library is that you write less code. This can be significant in languages like Java where Rest and JSON handling is very cumbersome. However working with Rest and JSON in python using standard libraries is very easy.
However, the main disadvantages of using a Cloudant/Co... | 0 | 0 | 0 | 0 | 2015-06-05T23:48:00.000 | 1 | 1.2 | true | 30,677,413 | 0 | 0 | 1 | 1 | I am writing an app in Python Flask that makes use of the Python HTTP library Request to interface with Cloudant on Bluemix. It is an easy interface that allows me to directly access the Bluemix VCAP information for Cloudant and of course the Cloudant API. However it does not make use of the CouchDB package, which seem... |
Python/CGI on IIS - find user ID | 30,683,908 | 1 | 0 | 591 | 0 | python,iis,cgi | When using Windows authentication on IIS, the server variables should contain the username in two variables: AUTH_USER and REMOTE_USER
CGI offers access to all server variables, check your Python docs on how to access them. | 0 | 0 | 0 | 1 | 2015-06-06T13:53:00.000 | 1 | 0.197375 | false | 30,683,672 | 0 | 0 | 1 | 1 | I have a very basic CGI based front end hosted on an IIS server.
I'm trying to find the users within my shop that have accessed this site.
All users on the network sign on with their LAN (Windows) credentials and the same session would be used to access the site.
The python getpass module (obviously) returns only the... |
Stopping a Django Model function being run more than once, at once | 30,684,683 | 0 | 1 | 49 | 0 | python,django,django-models,concurrency | What you can do is lock the slot for the booking once the payment is initiated. That way you only "lose" availability for a few moments. The lock can be done on the same centralized system that holds the rest of the information. For instance you can scale up the application servers but keep a single entry point to the ... | 0 | 0 | 0 | 0 | 2015-06-06T14:39:00.000 | 2 | 0 | false | 30,684,113 | 0 | 0 | 1 | 1 | I have a Django Model class for a booking slot. Once we have all the auxiliary data and payment is ready to be made, we get a live availability and allocate a booking. This whole last step of the process takes a couple of seconds (mostly waiting on the payment provider to clear). In theory two payments coming through a... |
Update object in form view without any fields in Django | 30,691,728 | 0 | 0 | 448 | 0 | python,django | I don't think you need either of those. A simple DetailView would be easier; just override the post method and do the update there. | 0 | 0 | 0 | 0 | 2015-06-07T08:35:00.000 | 1 | 0 | false | 30,691,591 | 0 | 0 | 1 | 1 | I want to create a view having a form, But the form should not show any fields.
In the view I has to be able to confirm/accept the object and thus change the status field of the object.
I guess I can make a simple view inheriting from FormView without creating any input fields, find the object in the dispatch method, a... |
Can't open Django shell from PyCharm using manage.py shortcut | 30,695,913 | 1 | 1 | 3,553 | 0 | django,python-2.7,pycharm | Try PyCharm preferences.
Project: --> Project Interpreter --> -->
Ensure the correct python environment
Also double check your settings under
Build, Execution, Deployment --> Console --> Python Console | 0 | 0 | 0 | 0 | 2015-06-07T16:15:00.000 | 1 | 1.2 | true | 30,695,739 | 0 | 0 | 1 | 1 | I can run Django shell directly from terminal in PyCharm, but I can't run it from manage.py shortcut (tools -> manage.py task -> shell). But I can do any other operations using this shortcut.
When I am trying to run it using second way nothing happens.
I am using Django 1.7 and PyCharm 4.0.2. |
Reduce number of choices in Django | 30,699,316 | 0 | 0 | 64 | 0 | python,django | You need to make a new form class that is a subclass of ModelForm. Then the __init__ method of the ModelForm class change one of the things in self.fields after calling the superclass constructor. | 0 | 0 | 0 | 0 | 2015-06-07T22:13:00.000 | 1 | 0 | false | 30,698,999 | 0 | 0 | 1 | 1 | I have an IntegerField with choices.
The list of choices consists of 10 different choices. I have different ModelForm using this integerfield.
In some of the modelforms I don't want to display all of the choices.
Can I in the ModelForm reduce the number of available choices? |
What method gets called when you display an object? | 30,721,227 | 1 | 0 | 47 | 0 | python | Either
__repr__or __str__ will do it. | 0 | 0 | 0 | 0 | 2015-06-09T00:27:00.000 | 2 | 0.099668 | false | 30,721,173 | 1 | 0 | 1 | 1 | Assume I have a class that inherits from object. I create an instance of it pass that to print. It will display something like <__main__.ObjName object at 0xxxxxx>. Is there an object method that can be overridden to provide a return value when the object is accessed this way? |
python django class based view and functional view | 30,764,221 | 0 | 0 | 163 | 0 | python,django,views | This question can be answered by another question:
What is the difference between procedural and object oriented programming?
Class based views provide you the power of OOP. Code becomes reusable and abstract. The modularity improves.
Performance wise, I guess there is no difference between a class based and a functio... | 0 | 0 | 0 | 0 | 2015-06-10T15:43:00.000 | 2 | 0 | false | 30,761,147 | 0 | 0 | 1 | 1 | I am just curious that which one is better django's Class Based View or Functional view and why.
I personally feel functional view is quiet easy but its lengthy and class based view can work with few lines of code.
Is there any performance issue with these views?
Can anyone guide me why to use django's CBV ? On late... |
Using Jmeter OS Process Sampler to collect script data | 30,803,435 | 1 | 0 | 1,555 | 0 | python,command,jmeter | Hi you just have to print the data you need to pass to jmeter, and then use one (or more) regular expression to extract values. | 0 | 1 | 0 | 0 | 2015-06-10T15:52:00.000 | 2 | 0.099668 | false | 30,761,322 | 0 | 0 | 1 | 1 | Is it possible to collect the output of a python script using the "OS Process Sampler"?
My python script does a database query and returns "r1=123 r2=456 r3=789"
Is there a way to collect the r1, r2, r3 values and graph them? |
How do I Start/Stop AWS RDS Instances using Boto? | 30,766,635 | 0 | 2 | 4,092 | 0 | python,amazon-web-services,boto,amazon-rds,rds | No, that's probably the best you can do. The RDS API does not support the Stop/Start functionality of EC2 instances. | 0 | 0 | 0 | 0 | 2015-06-10T20:01:00.000 | 4 | 1.2 | true | 30,766,187 | 0 | 0 | 1 | 2 | I had a question about Amazon RDS. I wanted to Start/Stop AWS RDS Instances at my need . AWS Console does not allow me to do so.
The Only method I know is to take a snapshot of the rds instance and delete it and when I need it then a create rds instance using that snapshot.
Is there any better way to acheive the same... |
How do I Start/Stop AWS RDS Instances using Boto? | 53,375,932 | 0 | 2 | 4,092 | 0 | python,amazon-web-services,boto,amazon-rds,rds | You can only start or stop AWS RDS instance of single availability zone instances. For your case, you will have to check if the multi-AZ option is enabled or disabled.
Incase your database is in Multiple availability zone, the best way would be to take the snapshot and restore it. | 0 | 0 | 0 | 0 | 2015-06-10T20:01:00.000 | 4 | 0 | false | 30,766,187 | 0 | 0 | 1 | 2 | I had a question about Amazon RDS. I wanted to Start/Stop AWS RDS Instances at my need . AWS Console does not allow me to do so.
The Only method I know is to take a snapshot of the rds instance and delete it and when I need it then a create rds instance using that snapshot.
Is there any better way to acheive the same... |
Python - Can't install modules on mac | 30,767,756 | -1 | 0 | 176 | 0 | python,module,installation | You will often have to use sudo on mac, eg sudo python ...
This has been asked multiple times though, try searching before asking. | 0 | 0 | 0 | 0 | 2015-06-10T21:34:00.000 | 2 | -0.099668 | false | 30,767,702 | 0 | 0 | 1 | 2 | I've downloaded Beautiful Soup 4.3.2 and CD'ed to the right location on my disk. When I use 'python setup.py install' a load of lines run but then I get this problem:
error: could not create '/Library/Python/2.7/site-packages/bs4': Permission denied
Anyone know why this is?
Thanks a lot! |
Python - Can't install modules on mac | 30,770,660 | -1 | 0 | 176 | 0 | python,module,installation | Apparently, your limits of authority is lower a little to install the python.
First, you should change your users to root. commnad:su root
Second,execute commands to install python.
I hope this can help you. | 0 | 0 | 0 | 0 | 2015-06-10T21:34:00.000 | 2 | -0.099668 | false | 30,767,702 | 0 | 0 | 1 | 2 | I've downloaded Beautiful Soup 4.3.2 and CD'ed to the right location on my disk. When I use 'python setup.py install' a load of lines run but then I get this problem:
error: could not create '/Library/Python/2.7/site-packages/bs4': Permission denied
Anyone know why this is?
Thanks a lot! |
Django testing won't run because of syntax error | 30,778,955 | 0 | 0 | 110 | 0 | django,python-3.x,unicode,pycharm | Ok so I found the problem. as patrys sugested in a comment the file didn't use UTF-8 as encoding. To change that in pycharm I had to go to file->settings->editor->file encodings and change the file encoding for tests to utf-8. After I did that I had to go into the file and re eddit the § as they have now turned into qu... | 0 | 0 | 0 | 1 | 2015-06-11T10:35:00.000 | 1 | 0 | false | 30,778,437 | 0 | 0 | 1 | 1 | When I run my tests I get a syntax error: SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xa7 in position 0: invalid start byte
The cause of this seems to be that I use a § in a string on line 62. I'm using python 3.4.2 for the project and have used § elsewhere without getting a error. I got a friend to o... |
I want to write a django application that can respond to the HttpClient requests from an android device. Can I have an example code? | 30,787,714 | 0 | 0 | 131 | 0 | android,python,django,networking,android-networking | Django doesn't care what the client is, and Android's HttpClient don't care whether the url are served by Django, Tomcat, Rails, Apache or whatever. It's only HTTP. IOW:
learn to write a Django App (it's fully documented)
learn to use the Android's HttpClient (it's fully documented too IIRC)
connect the dots... | 0 | 0 | 0 | 0 | 2015-06-11T16:58:00.000 | 2 | 0 | false | 30,786,979 | 0 | 0 | 1 | 1 | I am working on a sensor app in android and I've to store the accelerometer readings on a django server and then retrieve them on my device. I am new to django and I don't know how to communicate with Android's HttpClient and a django server. |
How to automate the android phone back button using appium | 40,546,232 | 11 | 9 | 25,243 | 0 | android,python,navigation,ui-automation,appium | I guess maybe it depends on what version of the client library are you using because in Java driver.navigate().back() works well. | 0 | 0 | 1 | 0 | 2015-06-12T11:25:00.000 | 8 | 1 | false | 30,801,879 | 0 | 0 | 1 | 4 | I am working on test automation for a hybrid mobile application on Android using Appium(python client library). I haven't been able to figure out any means to automate or create a gesture for using the Phone back button to go back to the previous page of the app. Is there any driver function that can be used? I tried m... |
How to automate the android phone back button using appium | 31,707,929 | 13 | 9 | 25,243 | 0 | android,python,navigation,ui-automation,appium | Yes,try the driver.back(), it simulates the system back function. | 0 | 0 | 1 | 0 | 2015-06-12T11:25:00.000 | 8 | 1 | false | 30,801,879 | 0 | 0 | 1 | 4 | I am working on test automation for a hybrid mobile application on Android using Appium(python client library). I haven't been able to figure out any means to automate or create a gesture for using the Phone back button to go back to the previous page of the app. Is there any driver function that can be used? I tried m... |
How to automate the android phone back button using appium | 38,353,103 | 0 | 9 | 25,243 | 0 | android,python,navigation,ui-automation,appium | driver.sendKeyEvent(AndroidKeyCode.BACK);
does the job in Java | 0 | 0 | 1 | 0 | 2015-06-12T11:25:00.000 | 8 | 0 | false | 30,801,879 | 0 | 0 | 1 | 4 | I am working on test automation for a hybrid mobile application on Android using Appium(python client library). I haven't been able to figure out any means to automate or create a gesture for using the Phone back button to go back to the previous page of the app. Is there any driver function that can be used? I tried m... |
How to automate the android phone back button using appium | 50,558,943 | 1 | 9 | 25,243 | 0 | android,python,navigation,ui-automation,appium | For appium-python-client, to go back you should call this method:
driver.press_keycode(4) | 0 | 0 | 1 | 0 | 2015-06-12T11:25:00.000 | 8 | 0.024995 | false | 30,801,879 | 0 | 0 | 1 | 4 | I am working on test automation for a hybrid mobile application on Android using Appium(python client library). I haven't been able to figure out any means to automate or create a gesture for using the Phone back button to go back to the previous page of the app. Is there any driver function that can be used? I tried m... |
Odoo Reload on button click | 37,959,512 | -1 | 5 | 10,689 | 0 | python,python-3.x,odoo,odoo-8 | Just try this, may help you
'res_model': 'your.model.to.reload', | 0 | 0 | 0 | 0 | 2015-06-12T12:48:00.000 | 5 | -0.039979 | false | 30,803,511 | 0 | 0 | 1 | 1 | I want to reload a page in odoo on a click of a button. I tried this:
object_name.refresh()
return {'tag': 'reload'}
but it's not working.
How can I get it? |
Django south schemamigration KeyError | 30,805,141 | 0 | 0 | 92 | 0 | python,django,django-south | I figured out the last migration files were accidentally corrupted and caused the KeyError. | 0 | 0 | 0 | 0 | 2015-06-12T13:50:00.000 | 1 | 0 | false | 30,804,783 | 0 | 0 | 1 | 1 | I am trying to do a schemamigration in Django with south using the following command where core is the app I would like to migrate.
$ python manage.py schemamigration core --auto
Unfortunately this throws the following KeyError:
KeyError: u"The model 'externaltoolstatus' from the app 'core' is not available in this mi... |
Django package naming issues | 30,811,433 | 0 | 0 | 49 | 0 | python,django,naming-conventions | You can use relative imports likefrom .. import cool_project as long you modules are in a package. I would suggest you to rename your app to something else though. It would create unnecessary complexity | 0 | 0 | 0 | 0 | 2015-06-12T18:36:00.000 | 1 | 1.2 | true | 30,810,029 | 0 | 0 | 1 | 1 | I have developed a backend library, say, cool_project. Now I want to build a web interface for it. So I create a Django project. Of course, I want to name it cool_project: my mother told me that Hungarian notation is bad and that the name cool_project is much better than any of cool_project_web etc.
But now I have a co... |
Flask-WTF File contents lost when form fails validation and user resubmits form | 30,814,109 | 0 | 2 | 115 | 0 | python,flask,flask-wtforms | As @dirn stated, that is the nature of file uploads. You have two options to get around this.
Save the uploaded file temporarily (especially if its large) while you prompt the user to fix the input error (as suggested by @dirn). This would require extra logic to purge files (assuming the user decides they don't want t... | 0 | 0 | 0 | 0 | 2015-06-12T19:35:00.000 | 1 | 1.2 | true | 30,810,908 | 0 | 0 | 1 | 1 | I'm having an issue where the contents of an uploaded file, via a FileField, are lost when the user resubmits form. I'm guessing the easy answer is to force the user to re-upload the file however I was wondering if there might be a workaround that can avoid having the user re-upload. |
Google App Engine : Wrong Serving Url | 30,824,576 | 0 | 0 | 50 | 0 | image,google-app-engine,google-app-engine-python,serving | Try specifying size=0 in the images.get_serving_url method call.
eg. images.get_serving_url(blob_key, size=0) | 0 | 1 | 0 | 0 | 2015-06-13T08:40:00.000 | 1 | 0 | false | 30,816,730 | 0 | 0 | 1 | 1 | I have created a Google App Engine project where it's possible to upload photos. Uploading part is working fine and all the photos are uploaded in proper size. But when I try getting images.get_serving_url , it returns me serving_url appended with lh3.googleusercontent.com but according to GoogleAppEngine documentation... |
How to permissions to a group in Django 1.8? | 30,820,665 | 0 | 0 | 323 | 0 | python,django,read-write | Django Group and Permission applies on model itself. So for a specific entry of document if you want to give access to user in that case you need to change your schema of Document model. Just add a users_who_can_read=ManyToMany(Users), users_who_can_write=ManyToMany(Users), and at your view.py when a user is trying to ... | 0 | 0 | 0 | 0 | 2015-06-13T12:41:00.000 | 1 | 0 | false | 30,818,792 | 0 | 0 | 1 | 1 | I have a 'Document' model which has many-to-many relationship with User model.There is a separate web page in my project which displays the Document instance in a text editor.
Now suppose user who created one document wants to invite other users to this document.But he wants to give read-only permission to some and rea... |
Search box/field design with multiple search locations | 30,852,953 | 0 | 0 | 171 | 0 | python,search,search-engine,pyramid | I could see this being posted to the UX SE (ux.stackexchange.com I think?) site, or they might already have a question there touching on something like this. But personally I would probably lean toward either a dropdown selector with different types, or keeping the separate searches as-is. And I think I'd lean more t... | 0 | 0 | 0 | 0 | 2015-06-15T14:36:00.000 | 2 | 0 | false | 30,847,948 | 0 | 0 | 1 | 2 | Not sure if this question is better suited for a different StackExchange site but, here goes:
I have a search page that searches a number of different type of things. All (at the moment) requiring a different input field for each type of search. For example, one might search for a school or district name, a class name,... |
Search box/field design with multiple search locations | 30,860,645 | 0 | 0 | 171 | 0 | python,search,search-engine,pyramid | What happens to your search interface if the application changes? This is a very important aspect. Do you add another search type?
A search returns matches on the query string. A result set can contain different entities from different types. Then your search/resultset interface could apply filtering based on entity ty... | 0 | 0 | 0 | 0 | 2015-06-15T14:36:00.000 | 2 | 1.2 | true | 30,847,948 | 0 | 0 | 1 | 2 | Not sure if this question is better suited for a different StackExchange site but, here goes:
I have a search page that searches a number of different type of things. All (at the moment) requiring a different input field for each type of search. For example, one might search for a school or district name, a class name,... |
Importing models from a different Django project | 30,856,157 | 0 | 1 | 92 | 0 | python,django,django-models | Wouldn't there be security issues at letting an external site dictate what your db's structure looks like? A problem of any kind (or a man in the middle attack) could completely modify (or destroy) your database without you doing anything.
I'd say it's better to have API versions than what you're asking for. I'd prefer... | 0 | 0 | 0 | 0 | 2015-06-15T20:27:00.000 | 1 | 0 | false | 30,854,395 | 0 | 0 | 1 | 1 | I am setting up a public API for my app. I want to segregate my API code from my application code, so I am putting it in a new django project and am using "Django REST Framework" to build the scaffolding for the public API services.
I'm struggling with how to keep models in sync between my main application project, and... |
Django database table naming convention | 30,872,816 | 3 | 0 | 1,656 | 1 | python,django,database,naming-conventions | The default convention is better and cleaner to use :
It avoids any table naming conflict ( As It's a combination of App name and Model name)
It creates well organized database (Tables are ordered by App names)
So until you have any special case that needs special naming convention , use the default. | 0 | 0 | 0 | 0 | 2015-06-16T15:57:00.000 | 1 | 0.53705 | false | 30,872,599 | 0 | 0 | 1 | 1 | What is the convention/best practices for naming database tables in Django... using the default database naming scheme (appname_classname) or creating your own table name (using your own naming conventions) with the meta class? |
Python select epoll in Gevent | 30,926,961 | 1 | 0 | 1,187 | 0 | python,gevent,epoll | Gevent does not provide their own epoll implementation yet.
If you don't monkeypatch select it will block the entire process instead of just one greenlet. | 0 | 0 | 0 | 0 | 2015-06-16T18:22:00.000 | 1 | 1.2 | true | 30,875,263 | 0 | 0 | 1 | 1 | I'm working on GPIO stuff in Python, need to register the fd on epoll, since gevent monkey patched the python select library, there will not be select.epoll if monkey.patch_all(select=True), so here comes two questions:
Will be consequence that the monkey.patch_all(select=False)?
Or does Gevent provide its own epoll r... |
Python Relative Imports Only Work With Django | 30,880,320 | 1 | 0 | 112 | 0 | python,import | You can't simply execute main.py from dir2; you'll need a script of sorts that lives outside your whole app package, and then if you import app.dir2.main, you'll get app.dir1.utils as well through the relative import.
Create a script that does from app.dir2 import main, then run that outside the app package. And use t... | 0 | 0 | 0 | 0 | 2015-06-16T23:47:00.000 | 1 | 1.2 | true | 30,880,102 | 0 | 0 | 1 | 1 | Hi I use Django frequently and am constantly using relative imports along the lines of from .models import XXX for XXX in a models folder or from . import views for a file named views.py in same directory and it works fine there. But when I create my own Python application with a directory structure such as:
app/ con... |
Creating a centric REST API for a mobile and website application | 30,932,400 | 0 | 0 | 288 | 0 | php,python,rest,authentication | Actually I doesn't make great sense. From my experience I know that mobile apps and web pages even if use the same backend very often require completely different set of data, and - (I know premature optimization is the root of all evil) - number of calls should be minimized for mobile applications to make them running... | 0 | 0 | 1 | 0 | 2015-06-19T01:12:00.000 | 2 | 0 | false | 30,928,370 | 0 | 0 | 1 | 1 | My next project requires me to develop both a mobile and a website application. To avoid duplicating code, I'm thinking about creating an API that both of these applications would use.
My questions regarding this are:
Is this approach sensible?
Are there any frameworks to help me with this?
How would I handle authe... |
Access control in odoo/openerp | 31,235,475 | 0 | 2 | 176 | 0 | python-2.7,openerp,odoo,openerp-8,odoo-8 | Inherit the write method of the model and give it a raise when your condition (in this case the not owned products) is met. This way the user will receive a warning message and they cannot save the changed values. | 0 | 0 | 0 | 0 | 2015-06-19T06:59:00.000 | 2 | 0 | false | 30,931,897 | 0 | 0 | 1 | 1 | How to restrict the users to edit only the product attributes for non owned products in odoo/openerp?
Can this be achieved through record rules or coding? |
Why are nose tests leaving orphaned PhantomJS processes on Windows 8? | 30,966,232 | 0 | 1 | 131 | 0 | python,windows,selenium,phantomjs,chocolatey | What version of choco did you use to install PhantomJS (and what version of PhantomJS)? I believe we corrected this issue in most cases, but it is on newer versions of choco - and you need the shim to be generated in that newer version (which means install or upgrade, but we are adding a shim regen command). | 0 | 0 | 0 | 0 | 2015-06-19T10:09:00.000 | 2 | 0 | false | 30,935,500 | 0 | 0 | 1 | 1 | I have some Python Selenium nose tests running on Windows 8 with PhantomJS. I installed Chutzpah (PhantomJS) via Chocolatey.
When I run the nose tests, a "ShimGen" process appears and lots of "PhantomJS is a headless WebKit with JavaScript API (32 bit)" processes appear and use 50+mb of memory and never close. This ca... |
Unicode on Scrapy Json output | 30,964,853 | 1 | 1 | 2,012 | 0 | python,json,unicode,utf-8,scrapy | As I don't have your code to test, Can you try to use codecs
Try:
import codecs
f = codecs.open('yourfilename', 'your_mode', 'utf-8')
f.write('whatever you want to write')
f.close() | 0 | 0 | 1 | 0 | 2015-06-19T23:34:00.000 | 2 | 0.099668 | false | 30,948,736 | 0 | 0 | 1 | 1 | I'm having problem on json output of scrapy. Crawler works good, cli output works without a problem. XML item exporter works without a problem and output is saved with correct encoding, text is not escaped.
Tried using pipelines and saving the items directly from there.
Using Feed Exporters and jsonencoder from json l... |
Python Module in Django | 30,986,554 | 0 | 1 | 765 | 0 | python,django | Definitely go for "way #1". Keeping an independent layer for your service(s) API will help a lot later when you have to enhance that layer for reliability or extending the API.
Stay away from singletons, they're just global variables with a new name. Use an appropriate life cycle for your interface objects. The obvi... | 0 | 0 | 0 | 0 | 2015-06-22T17:04:00.000 | 1 | 0 | false | 30,985,798 | 0 | 0 | 1 | 1 | I am building my first Django web application and I need a bit of advice on code layout.
I need to integrate it with several other applications that are exposed through RESTful APIs and additionally Django's internal data. I need to develop the component that will pull data from various sources, django's DB, format it... |
GAE golang templates stopped working | 31,039,704 | 0 | 0 | 50 | 0 | python-2.7,google-app-engine,go | I re-installed Python (the module_test and other tests failed) and updated the gae-go sdk. This fixed my problem. I believe that a recently identified Flash exploit had something to do with it as I experienced a number of Flash crashes in web page ads just before the problems began. | 0 | 1 | 0 | 0 | 2015-06-23T16:46:00.000 | 1 | 0 | false | 31,008,719 | 0 | 0 | 1 | 1 | I've been successfully using go for months - last night my app started 404 page not found errors but only on pages that use Templates. Those that don't use the Template system work fine.
I re-installed the Go sdk and discovered that the Guestbook demo ( also uses Templates) doesn't work either. ... and then I notic... |
Django Functional Test for Time Delayed Procedure | 31,042,109 | 0 | 0 | 74 | 0 | python,django,selenium,functional-testing | I've decided that I am just going to call the method of the nightly methods directly, instead of making a truly functional test. | 0 | 0 | 0 | 0 | 2015-06-23T17:30:00.000 | 2 | 1.2 | true | 31,009,555 | 0 | 0 | 1 | 1 | I am learning TDD and am using Django and Selenium to do some functional testing. I wanted to make it so that a user selects a checkbox that essentially says "add 1 to this number nightly". Then, for all of the users that have this setting on, a nightly process will automatically increment the number on these accounts.... |
Making group in django app. | 31,019,876 | 1 | 0 | 53 | 0 | python,django,django-models,django-admin | Superusers are special as their permission system returns True on every permission request (it is hardcoded). There is no "super group". You can simply create a group and give it all permissions (so add, change and delete permission to every model). | 0 | 0 | 0 | 0 | 2015-06-24T06:29:00.000 | 1 | 0.197375 | false | 31,019,164 | 0 | 0 | 1 | 1 | I am making an app. In which multiple superusers are there and beneath these super user we have multiple user. I am able to make superuser.But I am not able to add user in that for that super user.I am relatively new in django. |
Django get a DOM object from an HttpResponse | 31,035,689 | 0 | 0 | 627 | 0 | python,django,httpresponse | Yes that's a way to parse HTML into a DOM tree. If other people don't do that, they might have other requirements.
In general your idea is not bad, it might require more CPU time then other testing method (for example regular expressions. But if it fits your needs for testing, just do it. Performance it rarely a probl... | 0 | 0 | 1 | 0 | 2015-06-24T19:27:00.000 | 2 | 0 | false | 31,035,318 | 0 | 0 | 1 | 1 | I want to do a unit test on a html page which is returned as a byte string in an HttpResponse object... e.g. "find_elements_by_tag_name". Is the solution simply to xml.dom.minidom.parseString the bytes of response.content?
I couldn't find any examples of people doing this online or in Django manuals or tutorials, wh... |
Is there anyway to run robot framework tests without a display? | 36,692,169 | 1 | 3 | 2,600 | 0 | python,selenium,robotframework,xvfb | Yes there is with Xvfb installed.
In very short:
/usr/bin/Xvfb :0 -screen 0 1024x768x24&
export DISPLAY=:0
robot your_selenium_test | 0 | 0 | 1 | 1 | 2015-06-25T08:59:00.000 | 2 | 0.099668 | false | 31,045,708 | 0 | 0 | 1 | 1 | I prepare some test suites for an e-commerce web site, so i use Selenium2Library which requires a running browser on a display. I am able to run these test on my local machine but i had to run them on remote server which does not have an actual display. I tried to use xvfb to create a virtual display but it did not wor... |
Send multiple POST requests a once | 31,067,192 | 0 | 2 | 1,192 | 0 | php,python,ios,server,backend | No it should not cause an error, you are requesting the server with an HTTP method(POST) which serves every request from a new user as a new request because HTTP is a stateless protocol it doesn't save user states(unless you are managing user sessions explicitly)
So if 100 users are requesting at the same time, they ar... | 0 | 0 | 1 | 0 | 2015-06-26T06:33:00.000 | 2 | 0 | false | 31,066,456 | 0 | 0 | 1 | 1 | I have an iOS app that is send a POST request to my server and then it runs a function and returns some data back to the app.
My question is if my app has lets say 100 people using it at the same time and make the POST request in quick succession, is this going to case an error?
I am on a shared server if that matters... |
What the difference between SOCIAL_AUTH_USER_MODEL(django-social-auth) and AUTH_USER_MODEL(Django)? | 31,069,180 | 1 | 0 | 1,091 | 0 | python,django,authentication,django-socialauth | To override the default django user model use AUTH_USER_MODEL. To use django-social-auth with the new model point to it by using SOCIAL_AUTH_USER_MODEL. Both use auth.User by default. | 0 | 0 | 0 | 0 | 2015-06-26T07:25:00.000 | 1 | 1.2 | true | 31,067,386 | 0 | 0 | 1 | 1 | A bit frustrated about this.
What the difference between those options?
Which I need to use to override default django user model?
What the value SOCIAL_AUTH_USER_MODEL has by default? |
Processing data from Google App Engine on a Google Virtual Machine | 31,260,767 | 0 | 1 | 47 | 0 | python,google-app-engine,virtual-machine,google-cloud-platform | Sticking with the described POST request using urllib2. We decided we might move this part of the project to a different provider so better to not use Google Cloud only methods. | 0 | 1 | 0 | 0 | 2015-06-26T08:23:00.000 | 1 | 1.2 | true | 31,068,381 | 0 | 0 | 1 | 1 | My website runs on Python on Google App Engine, and I've setup a Virtual Machine to use libraries that weren't supported by the default App Engine environment. Now I need to send data from my app to the VM and retrieve the response. Data in this case will be an email address and an email message.
Currently I am testin... |
Is it feasible to unpickle large amounts of data in a Python web app that needs to be scalable? | 31,069,570 | 0 | 2 | 1,053 | 0 | python,flask,scalability,binaryfiles | Pickle files is good way to load data in python. By the way consider using the C implementation: cPickle.
If you want to scale, using pickle files. Ideally you want to look for a partition key, that fits for your data and your project needs.
Let's say for example you have historical data, instead of having a single fil... | 0 | 0 | 0 | 0 | 2015-06-26T08:43:00.000 | 2 | 0 | false | 31,068,690 | 0 | 0 | 1 | 1 | I am working on my first web application. I am doing it in Python with Flask, and I want to run a piece of Python code that takes an object, with Pickle, from a (binary) file of several MB which contains all the necessary data. I have been told that so using Pickle in a web app is not a good idea because of scalability... |
If, Else inside html using Django templates | 31,069,665 | 1 | 0 | 4,761 | 0 | python,html,django,if-statement | There is no if-then control explanation in HTML, or whatever other programming capacities. HTML is a markup dialect. Writing computer programs isn't conceivable.
Css will permit you to pick between styles in light of classes and IDs.
You can do this sort of thing with JavaScript, yet you can keep it straightforward w... | 0 | 0 | 0 | 0 | 2015-06-26T09:16:00.000 | 4 | 0.049958 | false | 31,069,347 | 0 | 0 | 1 | 2 | I have a Django project that consists of many html pages.
I want to add an if else condition inside my html tag to return "None" whenever the time stamp = 0000-00-00 00:00:00 and return the time when it's not. My code is shown below, I used a tag to get the time in date format.
<td>{{ table.start_time|date:"Y-m-d G:i:... |
If, Else inside html using Django templates | 31,070,870 | 2 | 0 | 4,761 | 0 | python,html,django,if-statement | I just used another tag:
<td>{{ table.start_time|date:"Y-m-d G:i:s"|default:"None"}}</td>
Thanks all!! | 0 | 0 | 0 | 0 | 2015-06-26T09:16:00.000 | 4 | 1.2 | true | 31,069,347 | 0 | 0 | 1 | 2 | I have a Django project that consists of many html pages.
I want to add an if else condition inside my html tag to return "None" whenever the time stamp = 0000-00-00 00:00:00 and return the time when it's not. My code is shown below, I used a tag to get the time in date format.
<td>{{ table.start_time|date:"Y-m-d G:i:... |
How to fully develop Django projects in the cloud? | 31,069,855 | 0 | 0 | 134 | 0 | python,django,cloud | Developing directly in production environment is highly discouraged. You should develop locally using version control systems (git) and test suites to check everything works before the deploy.
Once you've checked everything works, you can pull changes from the remote repository to apply the modifications or use somethi... | 0 | 0 | 0 | 0 | 2015-06-26T09:20:00.000 | 2 | 0 | false | 31,069,449 | 0 | 0 | 1 | 1 | I have been working with Django on Linux with Sublime Text for a while, but I constantly switch to Windows for graphics design and gaming. I wonder what's the most effective way to develop Django completely in the cloud without having to setup new Django environment for every OS I touch. It would be fantastic if I can ... |
Django Python Social Auth, Authentication Canceled by Facebook app | 31,138,364 | 2 | 0 | 3,048 | 0 | django,facebook,python-social-auth | I did wrong Facebook app setup. In the Security / Server IP Whitelist I put 127.0.0.1 address. The problem was gone after removing this address (blank space is okey). | 0 | 0 | 0 | 0 | 2015-06-26T16:27:00.000 | 2 | 0.197375 | false | 31,077,965 | 0 | 0 | 1 | 2 | I am trying to implement website login using Facebook credentials. I see different responses when I press Cancel on Facebook widget or Okay. When I press Cancel I see the following
Environment:
Request Method: GET
Request URL: http://wakevent.com/complete/facebook/?redirect_state=cvZGNl42bKvgcDDDezBy14V... |
Django Python Social Auth, Authentication Canceled by Facebook app | 36,288,484 | 0 | 0 | 3,048 | 0 | django,facebook,python-social-auth | Check the redirect URL. I had wrongly specified redirect URL along with client ID while making post request. For Facebook redirect URI is optional. Try removing that and it will work fine. | 0 | 0 | 0 | 0 | 2015-06-26T16:27:00.000 | 2 | 0 | false | 31,077,965 | 0 | 0 | 1 | 2 | I am trying to implement website login using Facebook credentials. I see different responses when I press Cancel on Facebook widget or Okay. When I press Cancel I see the following
Environment:
Request Method: GET
Request URL: http://wakevent.com/complete/facebook/?redirect_state=cvZGNl42bKvgcDDDezBy14V... |
Where did Flask-Admin's `hide_backrefs` option go? How to display backrefs in admin list view? | 31,249,046 | 2 | 0 | 115 | 0 | python,flask,flask-admin | This option was removed because you can explicitly add id field to the create and edit forms. | 0 | 0 | 0 | 0 | 2015-06-26T19:12:00.000 | 1 | 0.379949 | false | 31,080,544 | 0 | 0 | 1 | 1 | Previous version of Flask-Admin had a hide_backrefs option which could be set to False if you wanted to show them in the admin view.
The current version seems to have it no longer. Does it go by some other name? If I want to display backreferences in the admin list view, is there a better solution than just manually se... |
TypeError: SetStrength() missing 1 required positional argument: 'strength' | 31,106,283 | 0 | 0 | 84 | 0 | python,oop | That method is defined as def SetStrength(self, strength):. That means that, in addition to the self which is passed automatically, you need to provide an additional argument - in this case, the new strength value you'd like to set. It works very similarly to setName, which you call with an argument on the previous lin... | 0 | 0 | 0 | 0 | 2015-06-29T00:32:00.000 | 2 | 0 | false | 31,106,242 | 0 | 0 | 1 | 1 | Error fixed - I only needed one parameter in the headers of the setters. Thanks |
Can Java Web Start be used to run server-side programs? | 31,113,115 | 1 | 0 | 94 | 0 | java,python,tomcat,java-web-start | Java WebStart will install a desktop application into the cache of the client. That will run on the client not on the server, however you can easily create a webapplication as a service, i.e. on Tomcat. The webapp will be able to receive client requests, i.e. via RMI, RESTfull service or webservice, call the proprietar... | 0 | 0 | 1 | 0 | 2015-06-29T09:37:00.000 | 1 | 0.197375 | false | 31,112,366 | 0 | 0 | 1 | 1 | I have a Java application that needs to run the proprietary software PowerWorld on the server and then return output to the client side Web Start window. Is this possible? How do I go about doing this?
I am using Apache Tomcat to run the server. My Java code uses Runtime.exec() to run a Python script that runs PowerWor... |
IPython notebook Jupyter cannot download as .py | 66,611,829 | 0 | 0 | 1,573 | 0 | ipython-notebook,jupyter | Try refreshing the web page and download as .py should show up. | 0 | 0 | 0 | 0 | 2015-06-29T18:18:00.000 | 2 | 0 | false | 31,122,778 | 1 | 0 | 1 | 1 | After I open Jupyter and write down codes, I want to download it as .py file, but it is always downloaded as HTML. How can I fix it? |
How do I print a list from views.py to the console? | 31,124,296 | 6 | 2 | 18,314 | 0 | python,django | If you are using the runserver command, you will see the output of print-statements in that command prompt, like a live logging. | 0 | 0 | 0 | 0 | 2015-06-29T19:41:00.000 | 3 | 1 | false | 31,124,202 | 0 | 0 | 1 | 1 | I'm a near-total newbie to Django, and am trying to debug a piece of code which is returning a null list to a template even though it should be returning a list with items in it. Is there any way to print the list to the console from within views.py for debugging purposes? I obviously can't run python views.py as the i... |
Require the user to change their password on first login? | 31,168,478 | 2 | 1 | 2,193 | 0 | python,django | In short, yes.
You need to know which users need to change their password. If you don't want to use a custom User model, I would recommend having another model to store the users that need to change their password. You would add the users to this table upon user registration/creation.
Then you could write a very simple... | 0 | 0 | 0 | 0 | 2015-07-01T16:59:00.000 | 1 | 0.379949 | false | 31,167,457 | 0 | 0 | 1 | 1 | I would like to force the user to change their password on first login. Can I do this with the default django authentication system? |
It's possible to do an XHR call and render the output with Selenium? | 31,212,344 | 0 | 3 | 1,233 | 0 | python,selenium,automation,webdriver | Selenium is really designed to be an external control system for a web browser. I don't think of it as being the source of test data, itself. There are other unit-testing frameworks which are designed for this purpose, but I see Selenium's intended purpose to be different. | 0 | 0 | 1 | 0 | 2015-07-03T17:46:00.000 | 3 | 0 | false | 31,212,059 | 0 | 0 | 1 | 1 | Well, the title says it all... It is possible to perform an XmlHttpRequest from Selenium/Webdriver and then render the output of that requests in a browser instance ? If so, can you enlight me please ? |
Effectively communicating between two Django applications on two servers (Multitenancy) | 31,227,735 | 1 | 0 | 843 | 1 | python,django,web-deployment,multi-tenant,saas | You could use different settings files, let's say settings_client_1.py and settings_client_2.py, import common settings from a common settings.py file to keep it DRY. Then add respective database settings.
Do the same with wsgi files, create one for each settings. Say, wsgi_c1.py and wsgi_c2.py
Then, in your web serve... | 0 | 0 | 0 | 0 | 2015-07-05T00:30:00.000 | 1 | 1.2 | true | 31,226,223 | 0 | 0 | 1 | 1 | I'm hoping to be pointed in the right direction as far as what tools to use while in the process of developing an application that runs on two servers per client.
[Main Server][Client db Server]
Each client has their own server which has a django application managing their respective data, in addition to serving as a ... |
Install in user site-package | 31,247,842 | 1 | 0 | 78 | 0 | python,easy-install,manual | User site-package refers to packages installed in ~/.local/lib[64]/python-VERSION/site-packages/
These packages are available as any other installed packages, but only to this specific user. It overrides system packages too. | 0 | 0 | 0 | 0 | 2015-07-06T13:45:00.000 | 1 | 1.2 | true | 31,247,510 | 1 | 0 | 1 | 1 | I have red at the help-page of easy_install that I have an ability to do "install in user site-package". What does this phase mean, "user site-package"? How does it affect functionality of the installed software? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.