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
Django delete superuser
67,849,420
-1
73
57,795
0
python,django
There is no way to delete it from the Terminal (unfortunately), but you can delete it directly. Just log into the admin page, click on the user you want to delete, scroll down to the bottom and press delete.
0
1
0
0
2014-11-03T11:36:00.000
7
-0.028564
false
26,713,443
0
0
1
2
This may be a duplicate, but I couldn't find the question anywhere, so I'll go ahead and ask: Is there a simple way to delete a superuser from the terminal, perhaps analogous to Django's createsuperuser command?
Django delete superuser
62,485,147
4
73
57,795
0
python,django
No need to delete superuser...just create another superuser... You can create another superuser with same name as the previous one. I have forgotten the password of the superuser so I create another superuser with the same name as previously.
0
1
0
0
2014-11-03T11:36:00.000
7
0.113791
false
26,713,443
0
0
1
2
This may be a duplicate, but I couldn't find the question anywhere, so I'll go ahead and ask: Is there a simple way to delete a superuser from the terminal, perhaps analogous to Django's createsuperuser command?
Import Data Efficiently from Datastore to BigQuery every Hour - Python
26,722,516
2
2
541
1
python,google-app-engine,google-bigquery,google-cloud-datastore
There is no full working example (as far as I know), but I believe that the following process could help you : 1- You'd need to add a "last time changed" to your entities, and update it. 2- Every hour you can run a MapReduce job, where your mapper can have a filter to check for last time updated and only pick up those entities that were updated in the last hour 3- Manually add what needs to be added to your backup. As I said, this is pretty high level, but the actual answer will require a bunch of code. I don't think it is suited to Stack Overflow's format honestly.
0
1
0
0
2014-11-03T20:00:00.000
2
0.197375
false
26,722,127
0
0
1
1
Currently, I'm using Google's 2-step method to backup the datastore and than import it to BigQuery. I also reviewed the code using pipeline. Both methods are not efficient and have high cost since all data is imported everytime. I need only to add the records added from last import. What is the right way of doing it? Is there a working example on how to do it in python?
Relate stock location to product model - OpenERP report
26,728,276
1
1
462
0
python,openerp,openerp-7,odoo
You have to create a parser for you report. And it is this parser that returns the list of products.
0
0
0
0
2014-11-03T20:29:00.000
1
1.2
true
26,722,621
0
0
1
1
I made a new report on OpenERP, for stock module, which uses the product.product model, like the default one which is Stock Level Forecast. Now, what is the problem I have, I need this report to be shown on "Location Structure->Physical Locations->Warehouse->Analyze current inventory" It is showing there, no errors, everything's fine, but my problem is, because this report is tied to product.product I need to show some product fields (already declared on report) and the location_id of the warehouse I'm querying. Obviously if I loop over the current location on my report, it throws an error, because this is a stock object, and not from product. So, my question is, how can I bring all product fields into stock, to effectively report all product fields AND stock location at the same time? I guess I should make a related field, or a one2many there, but I'm very confused at this point. Any ideas? I hope I explained myself, if you need the code please let me know I'll edit my question then. Thanks in advance!
Django field that is a hybrid of text file upload and/or text box
26,726,763
0
0
121
0
python,django,forms,django-admin
Regardless of the method of input chosen, the data would be stored as a text column in the backing database. In that case, I would use a regular CharField. It just makes more sense. In the form, use 2 not required fields instead: key_text and key_file. Overwrite clean() to make at least one required. Then overwrite save(...).
0
0
0
0
2014-11-04T01:12:00.000
1
0
false
26,726,169
0
0
1
1
I'm trying to see if this is possible: a Field object that is rendered as both a file upload prompt as well as a text box. Since my app deals with SSL certificates and keys, it makes sense to allow the user to either upload a key/cert file, or paste the key/cert in directly. Regardless of the method of input chosen, the data would be stored as a text column in the backing database. This would purely be for convenience's sake.
Django site-external access
26,743,769
0
0
290
0
python,django
By others, do you mean someone on your local network or someone on internet. On local network its very easy, instead starting the local developmnet server by python manage.py runserver you can do python manage.py runserver 10.1.0.123:8000 (assuming 10.1.0.123 is your system's ip), then people on you local network can access http://10.1.0.123:8000 to see your site. If you want to show it to someone on internet, then either you host it on something like heroku, or another cheap and quick method if to configure your router to divert the specific port to your machine and give that person your dynamic ip. This only applies if you have a router like in a home dev setup. You can go to google and just type what is my ip and get your dynamic static ip
0
0
0
0
2014-11-04T19:30:00.000
2
0
false
26,743,435
0
0
1
1
A bit of a beginner question.Iv just started learning Django and can pretty much create basic stuff .Now when I want to access my website on my computer I just type in the local URL and I can access the site,other links etc. If I want to show this to someone else how would I do it?..They wouldn't be able to just type in the local url so what would they need to do to access it?Also If someone asks me to create an API for them what exactly does it mean?I'm a beginner with web technologies so any help would be appreciated! Thanks.
Control activated webservices
26,754,714
0
0
39
0
python,django,web-services
Usually you have a webserver (Apache, nginx...) before that. Depending on the webserver and OS it can be rather easy to deactivate a site. For example Ubuntu + Apache configure a default host that returns only 503 Service Unavailable configure a site configuration with a VirtualHost with the actual WSGI setup for the webservice activate the website with a2ensite <name> and service apache2 reload activate the website with a2dissite <name> and service apache2 reload But there are very many other solutions to your problem.
0
0
0
0
2014-11-05T10:07:00.000
1
0
false
26,754,378
0
0
1
1
i'm new in all of webservices and more webservices with python. I tested bottle, ladon, flask and django REST framework... With different opinions but all working more or less fine. Now i need to have something like a admin view to start or stop these services. Looking these frameworks i cant find anything about it. I searched here and neither. So i was looking for something like admin django view where i can start o stop a service. Which framework or technology do you recommend me? thank you.
Why should I use an API as django-tastypie or django-rest-framework?
26,779,279
2
0
768
0
python,django,rest,django-rest-framework,tastypie
For the exact same reasons than you used the django-admin for the admin instead of writing views, forms and templates from scratch: less work tested and approved by many other developers therefore more secured DRF has a really nice architecture. When you use it, you'd think "that's how I would have done it" (the truth is "this is how I wish I would have done it"). DRF also let you browse/test the API via HTML. 'External developers' who wants to use the data from my website on their own website? Yes For me to get a nice overview of my data (even though the admin does this job good)? Admin is better indeed for that. Use the create, read, update and delete functions in ajax calls on different pages on my website? Yes Or should all views that get data from a model get the data through an API to check permissions etc.? You don't have to get data through your API (is that what you mean?). I've never setup an application this way. That being said, you can do it, start by building an API both for you and external developers especially if you're going to use a lot of Javascript.
0
0
0
0
2014-11-06T11:52:00.000
1
0.379949
false
26,778,828
0
0
1
1
I have been looking at django-tastypie and django-rest-framework. What is the advantage of using an API? I've thought of following use cases. Which use cases is an API primarily intended for? 'External developers' who wants to use the data from my website on their own website? For me to get a nice overview of my data (even though the admin does this job good)? Use the create, read, update and delete functions in ajax calls on different pages on my website? Or should all views that get data from a model get the data through an API to check permissions etc.? I have read some of the documentation for both APIs but it's still not completely clear to me. Django has request.is_ajax() and Django 1.7 introduced JsonResponse so I cannot see why a big complex framework could make a better job sending and receiving json but I guess I'm wrong based on the number of developers who use the api frameworks :-D
Scrapy ROBOTSTXT_OBEY not working in all cases
29,877,623
0
0
890
0
python,scrapy,robots.txt
Scrapy uses Python standard robots.txt parser which doesn't support wildcards.
0
0
0
0
2014-11-06T14:06:00.000
1
1.2
true
26,781,438
0
0
1
1
So I have a Scrapy project set up and I have enabled the ROBOTSTXT_OBEY middleware which is working fine on robot.txt files that are in the following format: User-agent: * Disallow: /tools/ But when the same spider on a site with a robots.txt file in the following format it doesn't work: User-agent: * Disallow: *?next This results in pages still being crawled that should be blocked by robots.txt, the by the way in completely valid markup for a robots.txt file. Just wondered if anyone could shed any light on why this might be?
use email address as datastore key using python app engine
26,784,116
0
0
98
0
python,google-app-engine,google-cloud-datastore
When you create your entity do this: MyModel(id=emailAddress).put() then use get_by_id user = MyModel.get_by_id(emailAddress)
0
0
0
0
2014-11-06T15:44:00.000
1
1.2
true
26,783,510
0
0
1
1
I define my model ndb in python. I want to use the email address of a user as the key, how do I do that? user is passing in the email address through an html form. I have everything setup and working. I just don't know how to specify that the email address string is the key.
How to get Authentication header to persist
26,803,136
4
4
364
0
python,django,http,authentication,cookies
No, only cookies stored in browser persistently. All other headers are transient by HTTP protocol definition.
0
0
1
0
2014-11-07T01:50:00.000
1
0.664037
false
26,792,751
0
0
1
1
I am trying to setup token based authentication in python. using Django/DRF. but this is more about http in general i think. When users put in username/password I return to them their token via JSON. The client then can post the token in HTTP Header for me to check. My problem is I want the token to persist in the header automatically, just like cookies. When the server says "set-cookie" to browser (Chrome/FF), the browser will automatically send up the cookie without me actually doing anything. Is there something I can do with this token? I have tried storing it in header: "Authorization", but the browser didn't return it. Is there something like "Set-Authorization"? thanks
Web application + Mobile App Python/Django architecture
26,801,669
0
0
2,645
0
android,python,django,architecture,django-rest-framework
I don't use Django but I am currently using Angular with Flask as my REST backend. I think the hybrid approach is useful if your app benefits from caching rendered content. An example would be something like a blogging site where you may store Markdown but render HTML and thus the content is largely unchanging. If this content is shared across many users it can be very beneficial to generate once on the server and serve it to many clients. However if your reasoning is that because mobiles are relatively under-powered server-side rendering will improve the render time, this does not necessarily hold true. Serving the JSON data model will typically result in less network traffic (obviously dependent on browser caching) which is important for mobile client responsiveness. For my own part I prefer to render on the client and keep the server-side rendering to some very minimal templates. I find this results in a much better REST API that I can then use to provide external developer access or plug in other client UIs. My client code lives on the client side in Angular, my REST interface is clean, and security is always uppermost in my mind because I have to assume that the client code is potentially hostile. That said I can see a use for server-side rendering even with Angular. For content that is fairly static it would be great to generate this server side, cache it, and then ngInclude it.
0
0
0
0
2014-11-07T11:47:00.000
1
0
false
26,800,566
0
0
1
1
I'm starting a new side project in order to learn some new technologies and I have several doubts about the architecture I should use. My idea is developing an app both for web and for mobile (Android app mainly), so I think I need to implement the following: REST API service (with django-rest-framework). Web application (with django). Android app. After researching over stack overflow and Internet I have found 3 main "architectures" for the web part (server-rendering, client-rendering, and an hybrid model). In first place my idea was using the client-rendering model (with backbone or angular for the web client). However, I have seen that the hybrid model is a better choice. So here are my doubts: 1) Could I use django for server-rendering the web application pages? 2) Does Django web app "use" the API or the API is implemented using the same "library" as the django web? 3) Could/should I use a client framework (angular, backbone) for the web client (being server-rendered) ? Thanks in advance, and sorry about my short knowledge about django, etc.. This side project is just for that, to improve my knowledge about all this stuff.
Pycharm doesn't recognize Django installation
26,851,321
1
0
2,279
0
python,django,macos,pycharm
Thanks guys, just tried again and got an "install django" option which fixed it. Don't know why that showed up now but not before.
0
0
0
0
2014-11-10T15:32:00.000
2
1.2
true
26,847,210
1
0
1
2
I'm trying to create a new django project in Pycharm and I'm getting an error "No Django Support Installed in Selected Interpreter". After getting the message the first time I installed django, but the message persists. I have three versions of python installed: 2.5, 2.6 and 2.7, and I get the same message with all three. I can use the django commands from the terminal so it's definitely installed. I'm using Mac Os X 10.9. Any pointers? Thanks
Pycharm doesn't recognize Django installation
58,051,603
0
0
2,279
0
python,django,macos,pycharm
go to file/setting/Project:"name project" there you should add your interpreter that you want use for your project
0
0
0
0
2014-11-10T15:32:00.000
2
0
false
26,847,210
1
0
1
2
I'm trying to create a new django project in Pycharm and I'm getting an error "No Django Support Installed in Selected Interpreter". After getting the message the first time I installed django, but the message persists. I have three versions of python installed: 2.5, 2.6 and 2.7, and I get the same message with all three. I can use the django commands from the terminal so it's definitely installed. I'm using Mac Os X 10.9. Any pointers? Thanks
How to move from Django to REST-API/Thin Client?
26,850,033
1
0
146
0
javascript,python,rest
If I understand what you're trying to do, you might be looking for something like jQuery. It's a subtle JS framework that will make it easier to talk to your Django API, especially using Ajax and JSON.
0
0
1
0
2014-11-10T17:54:00.000
2
0.099668
false
26,849,884
0
0
1
1
We are thinking to move away from Django and separate the backend and frontend. The backend is straight forward as I have done it plenty of times by exposing it as a Python RESTful API. Whats new to me is the thin client part. Theoretically I could just write HTML and plain javascript to talk to the API. Is there a macro-framework that would help me to achieve that? Beside AngularJS, what other thin client frameworks could I utilise without reinventing the wheel?
Python Flask application cannot be accessed by remote computers in network
26,857,138
7
2
1,120
0
python,python-2.7,flask
Your app.run() function must be app.run(host='0.0.0.0') in order to give access other devices on same network.
0
0
0
0
2014-11-11T03:45:00.000
1
1.2
true
26,857,111
0
0
1
1
I ran a simple flask web application on python on my localhost. The web application is running on 127.0.0.1:8000. But I cannot access it from a remote machine in my network using myHostComputerIPaddress:8000. My host is a windows machine. Please advise.
how to protect request information from 3rd party android apps using python
26,860,181
1
0
39
0
android,python
Assuming you will be using a REST-based setup you might want to look into using ssl certificates and use https for verification and signal protection. For a simpler solution, use a pre-shared-key and put it in the header of the request. With that said your setup will only be as safe as your key management. Encryption and information security is hard. Good luck!
0
0
1
0
2014-11-11T06:53:00.000
1
1.2
true
26,859,236
0
0
1
1
how to protect request information from 3rd party android apps using server side. Hello, anybody can help, how to identify 3rd party android apps and we protect access from 3rd party
How to access a given list element in django templates?
26,866,366
0
0
983
0
python,css,django
You can just use menu.2 in your template.
0
0
0
0
2014-11-11T13:43:00.000
3
0
false
26,866,307
0
0
1
3
I have a list of values in my view where I want to store some classes name and pass them to the template. Here is the list in the view: menu = ['','disabled','','',''] and my code for the template <li class="{{ menu|slice:"1:2"|first }}"></li>. So far this is the only working code I came with, is there a better way to retrieve the element menu[2] from this list? what is the proper way in django to callback the element[n] of a list within the template?
How to access a given list element in django templates?
26,866,393
0
0
983
0
python,css,django
An alternative is to get the element[n] that you need in your view, and pass it to the template directly. Generally speaking, It's a better approch to pass to the template the data that you're going to actually use. So why pass a full list to use only one item of it?
0
0
0
0
2014-11-11T13:43:00.000
3
0
false
26,866,307
0
0
1
3
I have a list of values in my view where I want to store some classes name and pass them to the template. Here is the list in the view: menu = ['','disabled','','',''] and my code for the template <li class="{{ menu|slice:"1:2"|first }}"></li>. So far this is the only working code I came with, is there a better way to retrieve the element menu[2] from this list? what is the proper way in django to callback the element[n] of a list within the template?
How to access a given list element in django templates?
26,866,364
0
0
983
0
python,css,django
menu.1 should work if you know the exact index of your list, it could be cleaner and more explicit to do retrieval in your view. context['menu_target'] = menu[1] instead of having a list of empty values and accessing them in your template
0
0
0
0
2014-11-11T13:43:00.000
3
1.2
true
26,866,307
0
0
1
3
I have a list of values in my view where I want to store some classes name and pass them to the template. Here is the list in the view: menu = ['','disabled','','',''] and my code for the template <li class="{{ menu|slice:"1:2"|first }}"></li>. So far this is the only working code I came with, is there a better way to retrieve the element menu[2] from this list? what is the proper way in django to callback the element[n] of a list within the template?
Selenium webdriver + PhantomJS processes not closing
29,312,102
0
1
809
0
python,selenium-webdriver,phantomjs
Go figure. Problem resolved with a reboot.
0
0
1
0
2014-11-11T15:34:00.000
2
1.2
true
26,868,492
0
0
1
1
Here's just about the simplest open and close you can do with webdriver and phantom: from selenium import webdriver crawler = webdriver.PhantomJS() crawler.set_window_size(1024,768) crawler.get('https://www.google.com/') crawler.quit() On windows (7), every time I run my code to test something out, new instances of the conhost.exe and phantomjs.exe processes begin and never quit. Am I doing something stupid here? I figured the processes would quit when the crawler.quit() did...
Removing the .py file of a Django view does not actually remove the view
26,870,947
0
0
85
0
python,django,django-views
The most likely explanation is that you did not remove pages/views.pyc If that file is still present, then Python will load it. Whenever you remove a .py file make sure to remove the .pyc too. The .pyc is the "compiled" version of your .py file.
0
0
0
0
2014-11-11T16:58:00.000
1
0
false
26,870,235
0
0
1
1
I have a project in Django. I'm trying to change some logic in /pages/views.py. But my changes are not applied. Then to test I removed /pages/views.py but the pages still work. When I try to delete the /pages/templates/page.html, I get the error, which is as it should be. I don't understand why removing the script does not cause the error and how the site still works. The trace indicates that the script is invoked. The path is correct.
Generate HMAC signature for Google Maps at work API on Apigee Edge
27,083,574
0
1
490
0
javascript,python,google-maps,apigee,hmacsha1
I was able to make it work with Python. My solution is based mostly on Google's example script. I had to make changes to the line to decode the signature in order for it to work on Apigee Edge. Of course, this will only work for those who have a paid Apigee Edge account as the free version does not support Python.
0
0
0
0
2014-11-11T20:26:00.000
1
1.2
true
26,873,898
0
0
1
1
I am trying to generate a valid signature for the google maps API on Apigee edge. I've tried using a javascript callout to no avail. I am able to generate signatures but they don't match what google expects. I suspect it has to do with the encoding of the crypto key. I can't get python scripts to deploy at all (already opened a support case for that). I'm using CryptoJS which I believe does not binary encode the key. Has anyone already solved the problem of calling the Google Maps API for Work with an HMAC signature?
Check if current user is logged in using any django social auth provider
49,575,484
1
7
4,806
0
django,django-socialauth,python-social-auth
i was searching on that and the solution is user.social_auth.exists() it will return True if the user exists in the database else it will return false.
0
0
0
0
2014-11-12T03:58:00.000
7
0.028564
false
26,879,011
0
0
1
1
I would like to check if a user is logged in via social authentication or using the django default authentication. something like if user.social_auth = true?
Photologue zip uploader not working
26,918,549
0
1
98
0
python,django,photologue
There was a bug in Photologue 3.1 - the templates required for this feature were missing. Photologue 3.1.1 fixes this :-)
0
0
0
0
2014-11-13T03:29:00.000
1
0
false
26,900,849
0
0
1
1
According to the docs, The 'zip upload' functionality has been moved to a custom admin page as of 11/4/2014. This functionality is nowhere to be found, and my galleries upload field in admin disallows uploading zip files.
What is the most efficient way to write 3GB of data to datastore?
26,917,183
2
0
102
0
python-2.7,google-app-engine,google-cloud-datastore
If you need to store each row as a separate entity, it does not matter how you create these entities - you can improve the performance by batching your requests, but it won't affect the costs. The costs depend on how many indexed properties you have in each entity. Make sure that you only index the properties that you need to be indexed.
0
1
0
0
2014-11-13T19:45:00.000
2
0.197375
false
26,917,114
0
1
1
1
I have a 3Gb csv file. I would like to write all of the data to GAE datastore. I have tried reading the file row by row and then posting the data to my app, but I can only create around 1000 new entities before I exceed the free tier and start to incur pretty hefty costs. What is the most efficient / cost effective way to upload this data to datastore?
long-type in Python vs Java & C
26,939,554
0
0
1,680
0
java,python,long-integer,primitive
Python stores long integers with unlimited percision, allowing you to store large numbers as long as you have available address space. As for Java, use BigInteger class
0
0
0
1
2014-11-14T21:50:00.000
2
0
false
26,939,410
0
0
1
1
Why is Python able to store long-integers of any length were as Java and C only provide 64 bits? If there is a way in Java to do it, please show it.
Why does GAE use classes and self.response.out.write over functions and print?
26,952,993
3
0
733
0
python,google-app-engine,webapp2
Using Methods Each handler class has methods with names like get and post, after the HTTP methods GET and POST etc. Those methods are functions that handle requests. Each request to your server will be routed to a request handler object, which is a new instance of some request handler class. So, a request handler instance is created per request, and is garbage collected once its HTTP response is sent. By inheriting from webapp2.RequestHandler, your handler classes get a bunch of functionality out the box for free. For example, handler instances will have the data from the HTTP request parsed into dictionaries and bound to self as self.request.headers and self.request.body automatically. The webapp2.RequestHandler class also provides self.response, which is what you write your response data to. Once the new request handler instance is initialised, the inherited __init__ method calls the method that maps to the HTTP request method, so assuming a GET request, it calls self.get. The webapp2.RequestHandler class doesn't implement those methods; your derived class does. Responding Neither print nor the return value of the handler method are used here. You do not 'return a response' with this framework; you write the response to the request handler instance's (inherited) self.response property. Your instance inherits self.response.out.write (which is aliased to self.response.write), which concatenates its argument to the body of the response, initially an empty string. Note: You can call self.response.clear to clear the response body. When you return from your handler method - get or post etc. - the return value is ignored. The framework uses the state of self.response to automatically create and send a HTTP response for you. There's a bunch of subtleties that the framework takes care of behind the scenes too. Classes Over Functions The main advantage is in inheritance. Normally, you'll create a single BaseHandler class that derives from webapp2.RequestHandler. The BaseHandler class will contain the core functionality for your actual handlers. It might include some logic for converting data into little JSON packages for a Web API, for example. All of the classes that actually handle requests would then be derived from your BaseHandler. You want a custom base class for your handler classes to derive from mainly so you can edit that base class. You want that base class to inherit from webapp2.RequestHandler so that all your handler instances inherit the framework magic. There is enough slight of hand to make the whole thing confusing, but it is easy to make sense of once you get it, and does save a lot of trouble. Technically, you could achieve all of the above just using functions and dictionaries, but Python is classically object oriented, so it would be painful and weird.
0
1
0
0
2014-11-15T06:51:00.000
1
0.53705
false
26,943,368
1
0
1
1
I'm a beginner and am wondering why we use self.response.out.write instead of print, and why we use classes, instead of functions, for the request handlers in the first place. Are there any special reasons?
Check whether element is clickable in selenium
26,947,299
9
20
53,151
0
python,html,selenium,selenium-webdriver
You can use webElement.isEnabled() and webElement.isDisplayed() methods before performing any operation on the input field... I hope this will solve you problem... Else, you can also put a loop to check above 2 conditions and if those are true you can specify the input text and again you can find the same element and you can get the text of the webelement and compare that text with the text you entered. If those matches you can come out of the loop.
0
0
1
0
2014-11-15T08:01:00.000
3
1
false
26,943,847
0
0
1
1
I'm able to verify whether or not an element exists and whether or not it is displayed, but can't seem to find a way to see whether it is 'clickable' (Not talking about disabled). Problem is that often when filling a webform, the element i want may be overlayed with a div while it loads. The div itself is rather hard to detect as it's id, name and even the css is flexible. Hence i'm trying to detect whether or not a input field can be 'clicked' or 'filled'. When the overlaying div is present, the field cannot be filled by a regular user (As the div would overlay the input field and not allow the user to fill it) but it can be filled by selenium. I want to prevent that and only allow selenium to fill it once the user can also fill it.
With PyCharm, how do I reference django files when using remote AWS interpreter?
27,120,852
0
1
215
0
python,django,pycharm
(Using PyCharm 4.0) Go to Tools --> Deployment --> and either select an existing server connection or create a new one. Under the Mappings tab, you can associate a local path with a remote path. I keep my Django project folder mapped to the one on the server. Once you hit OK, go back to Tools --> Deployment, and you should see a bunch of options available to you that were greyed out before, such as: Upload to [server name] Download from [server name] Sync to Deployed to [server name] Automatic Upload I find Automatic Upload handy for when I want the changes in newly saved Django files reflected on the server within seconds of hitting save.
0
0
0
0
2014-11-15T17:16:00.000
1
0
false
26,948,469
1
0
1
1
I have an existing django project on an AWS instance. I have copied my Python files to my local machine. PyCharm is configured to use the Python interpreter on the remote machine. The django file references are, naturally, not resolved by PyCharm, since the django files are not on the local machine. Is the usual procedure to copy all the django files from the remote server to my local machine. Or is there another way to get PyCharm to know where to look to resolve the django references?
Monitor Management Command Execution in Django
26,971,741
0
0
142
0
python,django
You could create a file named "i_am_running.log" at the beginning of your management command and remove it at the end if it. When running same management command, check for its' presence. In case of no exist - go further. Otherwise - abort.
0
1
0
0
2014-11-17T06:15:00.000
2
0
false
26,966,645
0
0
1
1
I'm writing a Django app that uses a management command to pull data from various sources. The plan is to run this command hourly with cron, and also have it run on user command from a view (i.e. when they add a new item that needs data, I don't want them to wait for the next hour to roll around to see results). The question is: How can I set up this command such that if it is already currently running, it won't execute? Is there some place where I can stash a variable that can be checked by the script before execution? My current best idea is to have the command monitor stdout for a while to make sure nothing else is executing, but that seems like a hack at best. This is the only task that will be running in the background. I'm basically trying to avoid using Celery here.
Real-time communication between app and webpage
26,985,616
2
1
651
0
android,python,sockets,redis,real-time
One approach might be: set up a database on a server on the internet program your app to save data to that remote database set up a webservice program the webservice to read data from the database and serve it as an html page For extra credit implement a REST style API which retrieves and serves data from the database create an ajax webpage which uses the API to fetch and display data (so you don't have to refresh the page constantly)
0
0
1
0
2014-11-18T02:28:00.000
1
1.2
true
26,985,577
0
0
1
1
I'm trying to figure out how to have a real time data displayed on a webpage through the use of an android app. For example, users are using android app and are scored (answering questions). My webpage will display the scores in order in real-time. Iv come to the conclusion to use Redis, but what exactly do i need for this to function? Do i need a web socket where my web page will communicate with. This socket could be python where it accesses the database and then responds with the scores in order? Im struggling to find out how exactly this would work as this is new to me. What exactly should i be looking for (terminology etc)? Thanks
Python mechanize wait and click
26,986,649
0
1
1,315
0
python,mechanize,mechanize-python
If it's an anchor tag, then just GET/POST whatever it is. The timer between links appearing is generally done in javascript - some sites you are attempting to scrape may not be usable without javascript, or requires a token generated in javascript with clientside math. Depending on the site, you can either extract the wait time in msec/sec and time.sleep() for that long, or you'll have to use something that can execute javascript
0
0
1
0
2014-11-18T04:31:00.000
2
0
false
26,986,623
0
0
1
1
Using mechanize, how can I wait for some time after page load (some websites have a timer before links appear, like in download pages), and after the links have been loaded, click on a specific link? Since it's an anchor tag and not a submit button, will browser.submit() work(I got errors while doing that)?
Rails app to work with a remote heroku database
26,994,319
1
0
58
0
python,ruby-on-rails,ruby,ruby-on-rails-3,heroku
I don't see any problem in doing this, as far as rails manages the database structure and python script populates it with data. My advice, but just to make it simpler, is to define the database schema through migrations in your rails app and build it like the python script doesn't exist. Once you have completed it, simply start the python script so it can start populating the Database (could be necessary to rename some table in the python script, but no more than this). If you want to test in your local machine you can one of this: run the python script in your local machine configure the database.ymlin your rails app to point to the remote DB (can be difficult if you don't have administration access to the host server, because of port farwarding etc) The only thing you should keep in mind is about concurrent accesses. Because you have 2 application that both read and write in your DB, would be better if the python script makes its job in a single and atomic transaction, to avoid your rails app finding the DB in an half-updated state. You can see the database like a shared box, it doesn't matter how many applications use it.
0
0
0
1
2014-11-18T09:32:00.000
1
1.2
true
26,990,840
0
0
1
1
I have built an application in python that is hosted on heroku which basically uses a script written in Python to store some results into a database (it runs as a scheduled task on daily basis). I would have done this with ruby/rails to avoid this confusion, but the application partner did not support Ruby. I would like to know if it will be possible to build the front-end with Ruby on Rails and use the same database. My rails application will need to make use MVC and have its own tables on the database, but it will also use the database that python sends data to just to retrieve some data from there. Can I create the Rails app and reference the details of the database that my python application uses? How could I test this on my local machine? What would be the best approach to this?
Python3 Django -> HTML to PDF
27,025,464
0
10
13,449
0
python,django,pdf,html-to-pdf
wkhtmltopdf requires CSS to be inlined static files to be locally present on the server static file urls to be os paths, eg: /home/ubuntu/project/project/static/file_name
0
0
0
0
2014-11-18T14:42:00.000
4
0
false
26,996,976
0
0
1
1
There are a lot of different ways of generating pdfs from a django webpage in python2. The most clean, probably, is pisa and reportlab. These do not work for python3 though. So far, the only method I've had success with is to render the template, write it to a file, and then use wkhtmltopdf via subprocess.popen. This works alright, but it doesn't load any of my static files, such as css and images. Are there any proper solutions? can wkhtmltopdf read my staticfiles from the command line, in some way, or is there a library like pisa/reportlab, which supports python3? I haven't been able to finde such a library
Run script on remote server from Django Webserver
27,115,581
1
3
1,638
0
python,django
After reading through and trying out various forum suggestions and spending solid time in Google, I've settled down with paramiko. It does exactly what I wanted and works like a charm for now. On click of a button on my website, running on server1, I make a request to run a python script. The python script uses paramiko to make SSH connections to server2, runs the necessary command and writes a response to a plain/text file. This plain/text file is rendered back to the request through django form as a response. This looks a little dirty now and there are more things to look into like, what happens if the command took very long time to execute or it erred out for some reason. I haven't spent time in figuring out answers for all those questions, but eventually will.
0
0
0
0
2014-11-18T23:11:00.000
2
1.2
true
27,005,924
0
0
1
2
I have a basic (server1) Django development web server and another server (server2) which has a python script that does some scientific calculations. Assume that the server1 has necessary authentication in place to run the script on server2. All I want to do is, click a button on the django website which would run the python script sitting on server2. Ideas that I have so far are, use some kind of SSH library to run the script and get response have a REST API setup on server2 to run the script Not sure if above ideas would work, please suggest your insight into this and if possible a simple example would be appreciated. More info: Server1 and Server2 has to be 2 separate servers, server1 is a webserver, while server2 can be any linux virtual machine. Also, the response from server2 has to be sent back to server1.
Run script on remote server from Django Webserver
27,006,689
0
3
1,638
0
python,django
There is no reason why server one cannot execute something like selenium or phantomjs on itself to navigate to your website on server2 and click a button on server 2 which then uses something like python's subprocess module to execute a program from server 2.
0
0
0
0
2014-11-18T23:11:00.000
2
0
false
27,005,924
0
0
1
2
I have a basic (server1) Django development web server and another server (server2) which has a python script that does some scientific calculations. Assume that the server1 has necessary authentication in place to run the script on server2. All I want to do is, click a button on the django website which would run the python script sitting on server2. Ideas that I have so far are, use some kind of SSH library to run the script and get response have a REST API setup on server2 to run the script Not sure if above ideas would work, please suggest your insight into this and if possible a simple example would be appreciated. More info: Server1 and Server2 has to be 2 separate servers, server1 is a webserver, while server2 can be any linux virtual machine. Also, the response from server2 has to be sent back to server1.
How do I truncate floats to two decimal places in cheetah templates?
27,010,118
3
1
525
0
python,templates,cheetah
I just discovered a solution via output from complex expressions using #echo: #echo '%.2f' % $my_float_var# This prints out my float in the variable $my_float_var with only two decimal places.
1
0
0
0
2014-11-19T05:49:00.000
3
0.197375
false
27,009,879
0
0
1
1
I'm currently using Cheetah Templates with my python code and I'm passing in a number of floating point numbers. I'd like to truncate these floats to only two decimal places within the template, e.g. 0.2153406 would become 0.21 Is it possible to do this within the Cheetah template of do I have to pass in already truncated strings?
Running CGI Python Javascript to retrieve JSON object
29,558,961
0
0
847
0
javascript,python,ajax,json,cgi
Have you checked your host's server logs to see if it's giving you any output? Before asking here, a good idea would be to ssh to your host, if you can, and running the program directly, which will most likely print the error in the terminal. This is far too general at the moment, there are so many reasons why a CGI request can fail ( misconfigured environment, libraries not installed, permissions errors ) Go back and read your servers logs and see if that shines any more light on the issue.
0
0
1
1
2014-11-19T14:38:00.000
2
0
false
27,019,558
0
0
1
1
I want to use javascript to retrieve a json object from a python script Ive tried using various methods of ajax and post but cant get anything working. For now I have tried to set it up like this My Javascript portion: I have tried $.post('./cgi-bin/serverscript.py', { type: 'add'}, function(data) { console.log('POSTed: ' + data); }); and $.ajax({ type:"post", url:"./cgi-bin/serverscript.py", data: {type: "add"}, success: function(o){ console.log(o); alert(o);} }); My Python import json import cgi import cgitb cgitb.enable() data = cgi.FieldStorage() req = data.getfirst("type") print "Content-type: application/json" print print (json.JSONEncoder().encode({"status":"ok"})) I am getting a 500 (internal server error)
Selenium PhantomJS click element with href="#"
51,226,805
0
2
800
0
python,selenium,selenium-webdriver,phantomjs
href="#" just refreshes the page when you select the link, for example if it was href=#top" when you select the link you would be brought to the top of that same page. You are probably doing it correctly, you can use driver.find_element_by_link_text('some text') or driver.find_element_by_partial_link_text('some text'), but clicking on that element is just routing you to that same page.
0
0
1
0
2014-11-19T22:54:00.000
1
0
false
27,028,599
0
0
1
1
Coding in Python 2.7. I have a crawler I setup and it works perfectly fine when driven by FireFox, but breaks when driven by PhantomJS. I'm trying to click on an element with href="#" The crux of the issue is that when the FF driver clicks on this element with the # href, it performs the javascript action (in this case revealing a hidden part of a layer), but when PhantomJS does it, it either doesn't perform the click or it does click it but # just reloads the same page (I can't tell which one). I've tried everything I can think of, including multiple ActionChains and clicking element by element all the way down to this one with the link. Nothing seems to work. Any ideas?
PyDev not appearing in Eclipse after install
27,035,599
0
3
7,516
0
python,eclipse
Had this same problem a few days ago. You might have downloaded the wrong version of PyDev for your python version (2.7.5 or something is my python version, but I downloaded PyDev for version 3.x.x) 1) Uninstall your current version PyDev 2) you have to install the correct version by using the "Install New Software", then uncheck the "Show only newest software" or whatever it is. Then select the version that matched your python version, and install :)
0
1
0
0
2014-11-20T08:11:00.000
3
0
false
27,034,666
1
0
1
1
I have Java version 7 and had installed PyDev version 3.9 from Eclipse Marketplace..but it's not showing up in New project or in Windows perspective in Eclipse..Can some one please tell me what i need to do ???
How to use java libraries in python processing
40,499,350
0
1
390
0
java,python
Use the add_library function: add_library("sound")
0
0
0
0
2014-11-21T02:12:00.000
2
0
false
27,053,070
1
0
1
2
Im using processing in python mode but I want to use the processing library sound. But I dont know how to import this into my program in python syntax. In java its like this: Import processing.sound.*; Thanks
How to use java libraries in python processing
28,146,057
0
1
390
0
java,python
You can use add_library(processing.sound). I used it with g4p library
0
0
0
0
2014-11-21T02:12:00.000
2
0
false
27,053,070
1
0
1
2
Im using processing in python mode but I want to use the processing library sound. But I dont know how to import this into my program in python syntax. In java its like this: Import processing.sound.*; Thanks
django development server, how to stop it when it run in background?
27,074,081
6
52
122,154
0
python,django,server
well it seems that it's a bug that django hadn't provided a command to stop the development server . I thought it have one before~~~~~
0
0
0
0
2014-11-21T16:50:00.000
10
1
false
27,066,366
0
0
1
5
I use a Cloud server to test my django small project, I type in manage.py runserver and then I log out my cloud server, I can visit my site normally, but when I reload my cloud server, I don't know how to stop the development server, I had to kill the process to stop it, is there anyway to stop the development?
django development server, how to stop it when it run in background?
27,066,460
3
52
122,154
0
python,django,server
As far as i know ctrl+c or kill process is only ways to do that on remote machine. If you will use Gunicorn server or somethink similar you will be able to do that using Supervisor.
0
0
0
0
2014-11-21T16:50:00.000
10
0.059928
false
27,066,366
0
0
1
5
I use a Cloud server to test my django small project, I type in manage.py runserver and then I log out my cloud server, I can visit my site normally, but when I reload my cloud server, I don't know how to stop the development server, I had to kill the process to stop it, is there anyway to stop the development?
django development server, how to stop it when it run in background?
50,886,343
1
52
122,154
0
python,django,server
From task manager you can end the python tasks that are running. Now run python manage.py runserver from your project directory and it will work.
0
0
0
0
2014-11-21T16:50:00.000
10
0.019997
false
27,066,366
0
0
1
5
I use a Cloud server to test my django small project, I type in manage.py runserver and then I log out my cloud server, I can visit my site normally, but when I reload my cloud server, I don't know how to stop the development server, I had to kill the process to stop it, is there anyway to stop the development?
django development server, how to stop it when it run in background?
53,480,387
-3
52
122,154
0
python,django,server
You can Quit the server by hitting CTRL-BREAK.
0
0
0
0
2014-11-21T16:50:00.000
10
-0.059928
false
27,066,366
0
0
1
5
I use a Cloud server to test my django small project, I type in manage.py runserver and then I log out my cloud server, I can visit my site normally, but when I reload my cloud server, I don't know how to stop the development server, I had to kill the process to stop it, is there anyway to stop the development?
django development server, how to stop it when it run in background?
66,500,994
4
52
122,154
0
python,django,server
Ctrl+c should work. If it doesn't Ctrl+/ will force kill the process.
0
0
0
0
2014-11-21T16:50:00.000
10
0.07983
false
27,066,366
0
0
1
5
I use a Cloud server to test my django small project, I type in manage.py runserver and then I log out my cloud server, I can visit my site normally, but when I reload my cloud server, I don't know how to stop the development server, I had to kill the process to stop it, is there anyway to stop the development?
Django: Not responding to the changes after git pull
27,075,384
1
1
923
0
python,django,git,digital-ocean
Two things: git reset --hard will just remove any changes to your current branch you may have. Try git fetch --all && git pull --rebase or git fetch --all && git pull. Try removing all '.pyc' files. An easy command to do that is (assuming you're in the root directory of your project): find . -name '*.pyc' -exec rm {} \;
0
0
0
0
2014-11-22T08:01:00.000
1
1.2
true
27,075,344
0
0
1
1
I have a Django 1.6 project using Gunicorn+Nginx. I have cloned it to my web server (DigitalOcean) and it looked fine and the site was working. Then I made some changes on the projects in my PC and pushed to GitHub. Then I downloaded the updates by using git fetch -all and git reset --HARD. The project in the server side was successfully overwritten (I confirmed this by opening the file where there are changes). However, when I open my site in the browser, it only reflected some of the changes. Specifically: the HTML/CSS part is updated as the newest version; BUT, the urls.py and settings.py still followed the old setting. For example, I created a "/login" url in the newest version. But when opening the browser, it showed error. It seemed that it is still reading the setting.py and urls.py of the old branch. I tried git branch, it showed that I am currently working on the master one, which is the newest one; I also try restarting the Gunicorn and Nginx. Nothing different observed. Could anyone please enlighten me? Really appreciate any help.
celery: programmatically queue task to a specific queue?
27,100,098
0
0
283
0
python,celery
you should do something like that: sometask.apply_async(args = ['args1','args2'], queue = 'dev')
0
1
0
0
2014-11-24T06:40:00.000
1
1.2
true
27,099,187
0
0
1
1
When I do sometask.async_apply(args=['args1','args2'], kwargs={'queue': 'dev'}) nothing ends up on the queue 'dev'. I'm wondering if I am missing a step somewhere? I have created the queue 'dev' already and it shows up under queues when I check the rabbitmq management.
Django Rest Framework organizing ViewSets and Routers
27,130,805
3
0
1,162
0
python,django,django-rest-framework
For what it's worth, I've always created a separate api/ subdirectory within my Django apps to hold all Django REST Framework related files. This is just one way of doing things but it's helped keep separation of concerns within our applications. The hierarchy looked like this... Django Project/ Django App/ views.py models.py urls.py api/ serializers.py viewsets.py
0
0
0
0
2014-11-25T14:44:00.000
1
1.2
true
27,129,642
0
0
1
1
Hi there so my question is probably about best practices when organizing ViewSets and the corresponding Routers in Django Rest Framework. According to the official documentation, the routers should be stored in the urls.py and the viewsets should be stored in views.py. My idea of an approach would be having the viewsets in a separate file like for example viewsets.py so that we don't end up mixing the normal Django views and the DRF Viewsets in the same file, improving readability. The same would go for the routers where we would creaate a file called routers inside each app and register then with the main Default router instance. These are my thoughts, but i am not sure how to: 1º Do this the proper way (the registering of the viewsets routers and all, should i place DefaultROuter in the __init__.py ?) 2º Is there a better approach? Basically i want to separate the logic per app and inside each app separate by django views and DRf viewsets
How to modify Django admin ManyToManyField text?
27,135,554
0
2
579
0
python,django,admin,manytomanyfield
The Django Admin select menus use the unicode value of the model instance to populate things like menus. Whatever your __unicode__ method returns should be what is in the select menu.
0
0
0
0
2014-11-25T19:49:00.000
4
0
false
27,135,428
0
0
1
1
I have "Articles" and "Modules" apps. Inside "Modules" app there is model which have to display articles and they're linked by ManyToManyField in "Modules". My question is how to modify text value in select field in Django admin? As default it displays names of articles, but i want also some information from Article model here. Is there a simple way to do that?
Is there a way to integrate a processing sketch written in Python in a webpage?
49,843,328
0
4
144
0
javascript,python,processing
At the moment there is no straightforward way to do this. But some workarounds can be found. For example, since Processing's python mode is using Jython language (Python on JVM) you can do the following: Compile the Jython code to Java bytecode Decompile Java bytecode to real Java code Use processing.js to make the sketch run in a webpage Of course, there are chances that the generated Java code will not be 100% Processing code, thus will not be converted to Javascript by the processing.js library.
0
0
0
0
2014-11-26T09:05:00.000
1
0
false
27,145,014
1
0
1
1
The title says it all. I spent a lot of time designing a sketch in Processing using the Python language. Now, I would like to put the sketch on a webpage. Of course, I could just translate the sketch from python language to javascript and use a javascript library for processing. However, this would be a very lengthy process. As such, do you know if there is a way to integrate a python sketch in the website? If yes, how to do that? Thank you in advance!
How can I remove version 0.9.7 of sqlalchemy and install 0.7.8 instead?
27,371,294
2
1
1,813
1
python,linux,python-2.7,ubuntu,sqlalchemy
To get passed this error I just simply ran the command: sudo easy_install "SQLAlchemy==0.7.8" The virtual environments do seem like the preferred method though, so hopefully I don't run into any additional problems from downgrading system-wide.
0
0
0
0
2014-11-27T01:37:00.000
2
1.2
true
27,161,760
0
0
1
1
I am using Ubuntu 14.04 and trying to run snoopy_auth which is a part of the snoopy-ng application I downloaded and installed from their GitHub. When running, I get an error that is documented on snoopy-ng's GitHub page, which says that it works using version 0.7.8. How can I downgrade sqlalchemy to 0.7.8? The error looks like: snoopy_auth -l [+] Available drone accounts: Traceback (most recent call last): File "/usr/bin/snoopy_auth", line 103, in drones = auth_.manage_drone_account("foo", "list") File "/usr/bin/snoopy_auth", line 29, in manage_drone_account self.db.create(self.drone_tbl_def ) File "", line 2, in create File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/util/deprecations.py", line 106, in warned return fn(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/interfaces.py", line 859, in create raise NotImplementedError() NotImplementedError
How to synchronise local Django sqlite database with the server one?
27,163,084
2
0
860
1
python,django,database,git
Follow the following steps to push from local and pull to server. make changes to models.py Use this cmd to add change to git . > git add models.py use this cmd to commit > git commit -m "your message" git push > this will push your local changes to repo. go to sever now. run cmd > git status see if there are any local changes done to models.py file. you can see those local changes using > git diff models.py If those changes are already in your repo. use this cmd to discard them > git checkout models.py Now run cmd which will take your latest changes from server.> git pull P.S. : Use the same commands for all the changes made to any file into the clone. South migrations for syncing database: Initial : 1. python manage.py schemamigration --initial 2. python manage.py migrate --fake Do any change to database and do following steps: 1. python manage.py schemamigration --auto 2. python manage.py migrate Do not checkin the migration folder created in app as it will conflict between your local and production clone. Note: All the history for south migrations are stored in south_migrations table in database.
0
0
0
0
2014-11-27T04:17:00.000
1
1.2
true
27,162,982
0
0
1
1
I have a working Django 1.6 project using sqlite deployed in Digital Ocean, Ubuntu. I use Git to update my project on server side. (Git clone and git pull thereafter) My question is: every time after I update my database locally (e.g. added some new tables), how can I synchronise with the server one? Using git pull results in conflicts that cannot be resolved. I can do it using git fetch --all and git reset --HARD. But it doesn't seem to be the correct way. Any help is greatly appreciated! Thank you in advance.
SQLAlchemy ORM: safely passing objects between threads without manually reattaching?
27,194,059
5
2
1,254
1
python,multithreading,sqlalchemy
Session.merge() is enough and should do what you're after, but even then it gets fiddly with threads. You might want to rethink this. Pass the primary key(s) to the worker instead of the objects, and then handle object loading and the actual work in the worker itself. No messing around with threading and open/closed sessions that will eventually lead to headaches. Once the workers can deal with the objects separately, you could even move the workers to a separate process (similar to what Celery does).
0
0
0
0
2014-11-28T17:57:00.000
1
1.2
true
27,193,849
0
0
1
1
I'm working on a multithreaded application that uses the SQLAlchemy ORM. It already uses scoped_session with the thread as its scope, but we are having some issues when we pass an ORM object from a worker thread back to the main thread. Since the objects are attached to the worker thread's session, when the worker thread is shut down, we start getting DetachedInstanceErrors on those objects. Is there a way I can generically tell the ORM objects to detach/reattach themselves to the correct session as needed? We spawn a new thread whenever we have a slow operation that we don't want locking up our UI, so putting the reattach code in everywhere we spawn a new thread would be a mess. I think we also need to be able to clone the ORM object when we spawn the thread, so that we can have one in the main thread and one in the worker thread. I see a "merge" but no "split". Is this possible?
Django custom command works on command line, but not call_command
27,198,456
0
1
591
0
python,django,python-2.7
It turns out that for my purposes, I needed to be calling my custom commands from within another custom command file. My intent was to have one file that would call my other custom commands and this wasn't working with just a regular Python file. As soon as I made this regular Python file into another custom command file, it worked for what I needed.
0
0
0
0
2014-11-28T22:47:00.000
1
1.2
true
27,196,845
0
0
1
1
I have a custom django admin call that I am able to successfully call from the command line using: python manage.py mycustomcommand. Therefore, the directories are setup with the necessary init files in 'management' and 'commands' folders, and I have listed the apps under INSTALLED_APPS in my settings file. When I try to run the command from another file and use call_command('mycustomcommand') is says the command is an unknown command. How does it work from the command line but not from call_command? I ran get_commands() from 'core.management' and my command is not listed there. Do I need to do something more so that it can be found? If it matters, I am trying to call mycustomcommand from an app directory that is different from the app directory where the custom command lives. All my app directories have the correct structure and are in INSTALLED_APPS. All my googling seems to suggest it should just work and I've tried all reasonable suggestions to no avail. Thanks for any insight.
DLL loading (C#/IronPython/C#) in VS2012
27,233,826
1
0
390
0
c#,.net,dll,ironpython
You can try replicating what "works for me". Create a solution containing: python project (ironpython) C# project Add a reference to desired oracle library (Oracle.DataAccess.dll) to C# project using the standard VS mechanism. C# project should also contains a post build step to copy the resulting dll and pdb into the place where python script can find it. In my case root of the python project. Your python project is selected as Startup Project. I use Ctrl-F5 and F5 to start it. In both cases things work as expected. In debug mode I am able to set and hit breakpoint in python and in referenced C# module. I can see the oracle library being loaded (Output window of debugger). However: The stack traces are C# only. Visual Studio 2013 Update 4 together with PTVS 2.1 crashes on occasions when debugging.
1
0
0
0
2014-11-30T01:01:00.000
1
1.2
true
27,208,926
0
0
1
1
I want to debug separate pieces of my application in Visual Studio 2012. I have C# executable which works with Oracle.DataAccess dll. It works fine. Within it IronPython runtime is invoked and it works fine too. Within these IronPython modules object from main C# application is invoked and it works fine with Oracle dll. If IronPython script is invoked standalone then it works fine and uses C# object fine as well. However in this case C# object doesn't see Oracle dll. To debug IronPython scripts I have to create separate Python solution so I cannot configure my C# solution. So I do not have control of C# references. GAC has right Oracle dll but how to tell C# dll to use it? Vise versa if I'm in C# solution where I can manage the references then I cannot add py files and debug them. In what way can I configure VS to be able to run/debug my application with dual entry C# or IronPython separately?
Storing client secrets on Django app on App Engine
27,214,235
0
7
812
0
python,django,google-app-engine
You can hardly hide the secret keys from an attacker that can access your server, since the server needs to know the keys. But you can make it hard for an attacker with low privileges. Obfuscating is generally not considered as a good practice. Your option 5 seems reasonable. Storing the keys in a non-source controlled file allows to keep the keys in a single and well-defined place. You can set appropriate permissions on that file so that an attacker would need high privileges to open it. Also make sure that high privileges are required to edit the rest of the project, otherwise, the attacker could modify a random file of the project to access the keys. I myself use your option 5 in my projects.
0
1
0
0
2014-11-30T14:06:00.000
2
0
false
27,214,104
0
0
1
2
I have a Django app that uses some secret keys (for example for OAuth2 / JWT authentication). I wonder where is the right place to store these keys. Here are the methods I found so far: Hardcoding: not an option, I don't want my secrets on the source control. Hardcoding + obfuscating: same as #1 - attackers can just run my code to get the secret. Storing in environment variables: my app.yaml is also source-controlled. Storing in DB: Not sure about that. DB is not reliable enough in terms of availability and security. Storing in a non-source-controlled file: my favorite method so far. The problem is that I need some backup for the files, and manual backup doesn't sound right. Am I missing something? Is there a best practice for storing secret keys for Django apps or App Engine apps?
Storing client secrets on Django app on App Engine
37,824,536
0
7
812
0
python,django,google-app-engine
A solution I've seen is to store an encrypted copy of the secret configuration in your repository using gpg. Depending on the structure of your team you could encrypt it symmetrically and share the password to decrypt it or encrypt it with the public keys of core members / maintainers. That way your secrets are backed up the same way your code is without making them as visible.
0
1
0
0
2014-11-30T14:06:00.000
2
0
false
27,214,104
0
0
1
2
I have a Django app that uses some secret keys (for example for OAuth2 / JWT authentication). I wonder where is the right place to store these keys. Here are the methods I found so far: Hardcoding: not an option, I don't want my secrets on the source control. Hardcoding + obfuscating: same as #1 - attackers can just run my code to get the secret. Storing in environment variables: my app.yaml is also source-controlled. Storing in DB: Not sure about that. DB is not reliable enough in terms of availability and security. Storing in a non-source-controlled file: my favorite method so far. The problem is that I need some backup for the files, and manual backup doesn't sound right. Am I missing something? Is there a best practice for storing secret keys for Django apps or App Engine apps?
Access URL parameters in django 1.7 template without using context processors
27,217,307
0
0
815
0
python,django,python-2.7,django-templates,django-views
You can try using custom tags in django templates.
0
0
0
0
2014-11-30T19:26:00.000
2
0
false
27,217,237
0
0
1
1
http://www.example.com/soe/?param1=val1 this is current url and I want to access variable {{param1}} in django template. (Django 1.7) I know there are already many threads available for this problem but all of them are using ContextProcessor.(or render_to_response) I'm simply using return render(request, template, {}) and dont want to use ContextProcessors. One way to solve this problem is I pass the value of param1 when rendering, I mean return render(request, template, {'param1': request.GET.get('param1')}) but I'm just wondering If I can access this variable in template itself? because there might be 10 parameters.
Operator in Java like // in python?
57,453,225
1
2
2,327
0
java,python,operators
One thing to notice is: in python 3: 6 // -132 = -1 in java: 6 / -132 = 0
0
0
0
0
2014-11-30T19:43:00.000
4
0.049958
false
27,217,401
0
0
1
1
Is there a form of the // operator that is used in python that I can use in java, or some sort of workaround? 10 // 3 = 3
Django best user model design
27,220,032
2
3
603
0
python,django,database-design,design-principles
First, if you want to use email as username, use the Django custom user functionnality. It works well. Then, note that it's not because you created your own User that you can't extend it with a Profile. So, a good solution could be : Create a Django custom User without trying to add specific fields to it (the one and only purpose here is to use email to log instead of username). Create a PatientProfile class that have a one-to-one relatioship (blank=True) with User class. This way, a patient that can log in will be related to a User instance and will use this instance for this purpose. On the other hand, the patient who can't log in won't be related to any User instance. In the end, there's no problem to use OneToMany relationship with PatientProfile for what's you want to do.
0
0
0
0
2014-11-30T19:59:00.000
1
0.379949
false
27,217,584
0
0
1
1
Probably some of you would tell that is a recurrent topic, but after reading many articles, it still seems very ambiguous to me. My question is about the best way to use and to extend the User model preserving the authentication (and others) mechanisms available in Django. However, I prefer to describe my design: There are users (Patients) that can sign up providing basic info (first name, last name, birth date, gender, email, password). Preferably, email should replace the username. When a Patient is in the application, it can register a new Patient (imagine a member of the family), but email and password are not required because they won't log into the system. For the first part, Django doc propose to extend User with a OneToOne relation to a Profile. However, to replace username by email they propose then to create a custom User extending from an AbstractUser, as well as an associated UserManager. The second requirement is like doing a one-to-many relation from users to users. So, according to Django, which should be the best strategy: creating a completely new user model and the one-to-many user-user adding an specific attribute that distinguish between main users and family members? OR extending Django User with a Profile and then a one-to-many relation profile-profile? Which option preserves the best the benefits of Django user authentication and model administration? Thank you for any comment, suggestion, example.
Show instant error page when database host is unavailable - django
27,225,478
0
0
271
0
python,django
You need to keep checking the socket connection status continuously in a script that will inform you regarding the same. In case you are more concerned with the performance issues then you can make use of a in memory caching system like redis etc. cheers :-)
0
0
0
0
2014-12-01T09:22:00.000
2
0
false
27,225,181
0
0
1
1
I want to show instant error page when database host is unavailable. Default behavior for django is that ,when user requests , it takes long time and then displays error page. Is there is any way to display some error instantly when database host is unreachable or database host is invalid with django without any delay ? Any suggestions ?
How to run Debug server for Django project in PyCharm Community Edition?
28,256,637
125
43
28,760
0
python,django,configuration,ide,pycharm
Yes you can. In Run -> Edit Configurations create new configuration [+] / Python Name: runserver Scrip Path: path_to/manage.py Parameters: runserver
0
0
0
0
2014-12-03T10:42:00.000
2
1.2
true
27,269,574
0
0
1
1
Has anyone had issues setting up a debug configuration for Django project in PyCharm Community Edition? Community Edition of the IDE is lacking the project type option on project setup and then when I am setting up Debug or Run config it asks me for a script it should run. What script would it be for Django, manage.py? Thanks in advance
can I combine NDB and mysqldb in one app on google cloud platform
28,197,823
0
1
62
1
google-app-engine,google-cloud-storage,google-cloud-datastore,mysql-python,app-engine-ndb
MySQL commands cannot be run on NoSQL. You will need to do some conversions during manipulation of the data from both DBs.
0
1
0
0
2014-12-03T17:47:00.000
1
0
false
27,278,297
0
0
1
1
Is it just about creating models that use the best fitting data store API? For part of the data I need relations, joins and sum(). For other this is not necessary but nosql way is more appropriate.
Plone Unified Installer missing Python
27,300,059
4
1
226
0
linux,python-2.7,plone,sles
The installer command: ./install.sh standalone --build-python --static-lxml=yes worked perfectly for me. The installer downloaded and built the Python and libxml2/libxslt components necessary to remedy the terribly out-of-date (and vulnerable) versions included with sles11sp3. System packages needed for the build were: gcc-c++ make readline-devel libjpeg-devel zlib-devel patch libopenssl-devel libexpat-devel man All installed via zypper. I'd advise not using sudo for the install. If you want to, you'll need to create the plone_daemon and plone_buildout users and the plone_group group in advance due to oddities in SUSE's adduser implementation.
0
1
0
0
2014-12-04T11:42:00.000
1
0.664037
false
27,293,173
0
0
1
1
I'm trying to install plone 4.3.4 on a SLES 11 SP3 64bit server via the Unified Installer. I've fullfilled all the dependencies listed in the readme.txt, but when I try to get the installer running with the command sudo ./install.sh --password=******* standalone I get the error message: which: no python2.7 in (/usr/bin:/bin:/usr/sbin:/sbin) Unable to find python2.7 on system exec path. I find that rather strange as in the description of the unified installer it is said "The new Zope/Plone install will use its own copy of Python, and the Python installed by the Unified Installer will not replace your system's copy of Python. You may optionally use your system (or some other) Python, and the Unified Installer will use it without modifying it or your site libraries." on the Plone-Website. So - what am I doing wrong??? I've just tried adding the parameter --build-python but had to find out that the libxml2-devel and libxslt-devel libraries that are available for SLES-11-SP-3 are sadly not up-to-date enough 2.7.6 instead of 2.7.8 and 1.1.24 instead of 1.1.26 respectively. So no joy there either. :-( Is there any way to install the current version of plone on SLES 11 SP3 64bit? Kate
In using OpenErp 7 or Odoo 8, how do I modify it such that a manager assigned to a project is the one who will approve all timesheet entries for it?
27,353,088
1
0
364
0
python,module,openerp-7,odoo,time-management
You can manage this by grouping each employee according to their privilege. For example you have two groups Managerial and employee group so each of them might have different or some how common privilege on certain python objects from OpenERP so please identify those python objects and explore more in Setting >> Users >> Groups
0
0
0
0
2014-12-05T04:35:00.000
1
1.2
true
27,308,836
0
0
1
1
I have downloaded and installed and also tested via a virtual machine online Odoo 8 and OpenErp 7. I have spent many hours tinkering with the apps and features of both. I am unable to find any way from hours I spend searching or tinkering for a method to change the approve timesheet functionality in the manner I will explain below. Each project will have an assigned manager. Any number employees can enter time for a project. Once employees send their timesheet to be be approved, each respective manager will only get that portion of the timesheet for which time was charged to the project they managed. They should be able to view each project and the employees in them.
Moving from RabbitMQ to Amazon SQS
27,317,451
4
0
3,023
0
python,django,amazon-web-services,rabbitmq,amazon-sqs
I haven't had any problems with slow performance on SQS, but then again it maybe that the be the nature of my apps don't count on sub-millisecond response times for items in my queue. For me the work done on the items in the queue contributes more to the lag than the time it takes to use the queue. For me the distributed, highly available and 'hands-off' nature of SQS suits the bill. Only you can decide whats is more important: a few more milliseconds of performance in a non-redundant system that you need to support yourself, or the 'queue as a service' offerings of AWS. Not knowing you application, I can't say if the perceived extra performance is a necessary trade off for you.
0
0
0
1
2014-12-05T12:32:00.000
2
1.2
true
27,315,968
0
0
1
1
Our startup is currently using RabbitMQ (with Python/Django) for messaging queues, now we are planning to move to Amazon SQS for its high availability & their delayed queue feature. But I am reading on INTERNET everywhere that SQS is slow performing & also very cost effective, so is it wise decision to move to Amazon SQS or should to stick to RabbitMQ? And if we its good to stick with RabbitMQ, whats the alternative solution for "delayed queues"?
How to select tables in scrapy using selectors whose class id have spaces in it?
41,831,890
0
0
2,468
0
python,xpath,web-scraping,scrapy
I had the same issue because I was trying to scrape a wikipedia page. The class name for the table shows up as "wikitable sortable jquery-tablesorter" because of the plugin mentioned in the other answer which adds to the class name after it is used. In order to pick up the table you can just look for the following class instead "wikitable sortable". This picks up the code for me.
0
0
1
0
2014-12-06T11:59:00.000
2
0
false
27,331,444
0
0
1
1
I'm trying to select all the tables inside a division which has xpath similar to //*[@id="mw-content-text"]/table[@class="wikitable sortable jquery-tablesorter"]. But the selector doesn't returns any value. How can I get through those tags which have spaces in their id/class ?
Python : How to read file timestamp which is in html page in python
27,334,938
0
0
225
0
python,html,timestamp,zip
In general, there is no way to know about the file's timestamp unless the web page gives it to you. Sometimes you can read the file's parent container and get an index page for all of its files, but most public web servers try to block that sort of thing.
0
0
0
0
2014-12-06T17:47:00.000
1
0
false
27,334,562
1
0
1
1
I have a zipfile in html page, Is there any way to read that file's create\modified timestamp in python. I know we can read timestamp if it is in local directory. Thanks in advance.
Problems setting up Python development server at http://127.0.0.1:8000/
27,339,105
0
0
1,753
0
python,django
You do not have to do more than you have done, however, you should make sure that you do not have the server from your previous project running, for one. To confirm, are you at the point in the tutorial where you have run django-admin.py startproject mysite . You have also run python manage.py migrate. Also, make sure that you are running python manage.py runserver such that the manage.py you are running corresponds to the manage.py in your new tutorial project. That is, check which directory you are running from.
0
0
0
0
2014-12-07T02:56:00.000
3
0
false
27,339,088
0
0
1
1
I'm running into problems trying to use "python manage.py runserver." According to the tutorial, I'm supposed to get a “Welcome to Django” screen when I visit my development server at http://127.0.0.1:8000/ but instead, I see one of my previous projects that's locally hosted on my computer. I'm wondering why this is, do I have to more specific or specify another when I use "python manage.py runserver"
uWSGI --http :80 doesn't listen IPv6 interface
27,342,634
7
3
1,462
0
http,python-3.x,ipv6,uwsgi
In your INI config file specify something like this [uwsgi] socket = [::]:your_port_number Or from the CL, ./uwsgi -s [::]:your_port_number The server shall now listen along all the interfaces (including IPv4, if the underlying OS supports dual stack TCP sockets)
0
1
0
1
2014-12-07T11:41:00.000
1
1.2
true
27,342,256
0
0
1
1
Why doesn't uWSGI listen on IPv6 interface, even if system is 100% IPv6 ready? As far as I could see there aren't parameters nor documentation covering this issue.
How to downgrade from Django 1.7 to Django 1.6
71,538,417
0
17
28,236
0
python,django,django-1.6,django-1.7
pip install Django==1.6 in CMD
0
0
0
0
2014-12-08T14:17:00.000
4
0
false
27,359,964
0
0
1
1
I started a new project a few months back using Django 1.7. The company has decided to settle on using Django 1.6 for all projects. Is there a nice way to downgrade from Django 1.7 to 1.6? Are migrations the only thing I have to worry about? Are the changes between the two versions large enough that I need to rewrite the app? I was hoping to just change the version in the requirements.txt and then install south and create new database migrations.
Can't connect to redis using django-redis
27,382,430
15
8
6,100
0
python,django,amazon-web-services,redis,django-redis
Ok, figured it out. What I needed to do was prefix my location with redis://. This is specific to the django-redis library and how it parses the location url. That explains why when I manually set up a StrictRedis connection using the python redis library I was able to connect.
0
0
0
0
2014-12-08T18:09:00.000
2
1.2
true
27,364,149
0
0
1
1
I've got a django project using django-redis 3.8.0 to connect to an aws instance of redis. However, I receive ConnectionError: Error 111 connecting to None:6379. Connection refused. when trying to connect. If I ssh into my ec2 and use redis-py from the shell, I am able to read and write from the cache just fine, so I don't believe it's a security policy issue.
Django 1054 - Unknown Column in field list
60,700,719
0
4
8,200
0
python,mysql,django,database,data-migration
I faced the same issue all what i do to get out this issue just drop all tables in my DB and then run: python manage.py makemigrations and : python manage.py migrate
0
0
0
0
2014-12-10T14:05:00.000
4
0
false
27,403,050
0
0
1
4
I have a Django project and I did the following: Added a table with some columns Insert some records into the db Added a new column that I didn't realize I needed Made an update to populate that column When I did a migrate everything worked just fine. The new db column was created on the table and the values were populated. When I try to run my tests, however, I now bomb out at step 2 above. When I do insert, I believe it is expecting that field to be there, even though it hasn't been created at that point yet. What should I do? EDIT: More info I first made a class, class A and did a migration to create the table. Then I ran this against my db. Then I wrote a manual migration to populate some data that I knew would be there. I ra n this against the db. I realized sometime later that I need an extra field on the model. I added that field and did a migration and ran it against the database. Everything worked fine and I confirmed the new column is in the database. Now, I went to run my tests. It tried to create the test db and bombed out, saying "1054 - Unknown column [my new column that I added to an existing table]" at the time when it is trying to run the populate data script that I wrote. It is likely looking at the table, noticing that the third field exists in the model, but not yet in the database, but I don't know how to do it better.
Django 1054 - Unknown Column in field list
40,621,929
0
4
8,200
0
python,mysql,django,database,data-migration
This happened to me because I faked one migration (m1), created another (m2), and then tried to migrate m2 before I had faked my initial migration (m1). So in my case I had to migrate --fake <app name> m1 and then migrate <app name> m2.
0
0
0
0
2014-12-10T14:05:00.000
4
0
false
27,403,050
0
0
1
4
I have a Django project and I did the following: Added a table with some columns Insert some records into the db Added a new column that I didn't realize I needed Made an update to populate that column When I did a migrate everything worked just fine. The new db column was created on the table and the values were populated. When I try to run my tests, however, I now bomb out at step 2 above. When I do insert, I believe it is expecting that field to be there, even though it hasn't been created at that point yet. What should I do? EDIT: More info I first made a class, class A and did a migration to create the table. Then I ran this against my db. Then I wrote a manual migration to populate some data that I knew would be there. I ra n this against the db. I realized sometime later that I need an extra field on the model. I added that field and did a migration and ran it against the database. Everything worked fine and I confirmed the new column is in the database. Now, I went to run my tests. It tried to create the test db and bombed out, saying "1054 - Unknown column [my new column that I added to an existing table]" at the time when it is trying to run the populate data script that I wrote. It is likely looking at the table, noticing that the third field exists in the model, but not yet in the database, but I don't know how to do it better.
Django 1054 - Unknown Column in field list
29,351,981
0
4
8,200
0
python,mysql,django,database,data-migration
Unless the new column has a default value defined, the insert statement will expect to add data to that column. Can you move the data load to be after the second migration. (I would have commented, but do not yet have sufficient reputation.)
0
0
0
0
2014-12-10T14:05:00.000
4
0
false
27,403,050
0
0
1
4
I have a Django project and I did the following: Added a table with some columns Insert some records into the db Added a new column that I didn't realize I needed Made an update to populate that column When I did a migrate everything worked just fine. The new db column was created on the table and the values were populated. When I try to run my tests, however, I now bomb out at step 2 above. When I do insert, I believe it is expecting that field to be there, even though it hasn't been created at that point yet. What should I do? EDIT: More info I first made a class, class A and did a migration to create the table. Then I ran this against my db. Then I wrote a manual migration to populate some data that I knew would be there. I ra n this against the db. I realized sometime later that I need an extra field on the model. I added that field and did a migration and ran it against the database. Everything worked fine and I confirmed the new column is in the database. Now, I went to run my tests. It tried to create the test db and bombed out, saying "1054 - Unknown column [my new column that I added to an existing table]" at the time when it is trying to run the populate data script that I wrote. It is likely looking at the table, noticing that the third field exists in the model, but not yet in the database, but I don't know how to do it better.
Django 1054 - Unknown Column in field list
31,042,146
0
4
8,200
0
python,mysql,django,database,data-migration
I believe this was because the migration scripts were getting called out of order, due to a problem I had setting them up. Everything is ok now.
0
0
0
0
2014-12-10T14:05:00.000
4
1.2
true
27,403,050
0
0
1
4
I have a Django project and I did the following: Added a table with some columns Insert some records into the db Added a new column that I didn't realize I needed Made an update to populate that column When I did a migrate everything worked just fine. The new db column was created on the table and the values were populated. When I try to run my tests, however, I now bomb out at step 2 above. When I do insert, I believe it is expecting that field to be there, even though it hasn't been created at that point yet. What should I do? EDIT: More info I first made a class, class A and did a migration to create the table. Then I ran this against my db. Then I wrote a manual migration to populate some data that I knew would be there. I ra n this against the db. I realized sometime later that I need an extra field on the model. I added that field and did a migration and ran it against the database. Everything worked fine and I confirmed the new column is in the database. Now, I went to run my tests. It tried to create the test db and bombed out, saying "1054 - Unknown column [my new column that I added to an existing table]" at the time when it is trying to run the populate data script that I wrote. It is likely looking at the table, noticing that the third field exists in the model, but not yet in the database, but I don't know how to do it better.
How to track django user details using zoho CRM
27,498,436
0
0
812
0
python,django,crm,zoho
All you need is export django auth but if extender user model is there then you can also take extended user model too... Please update your question what Database you are using ?
0
0
0
0
2014-12-11T06:46:00.000
2
0
false
27,416,913
0
0
1
1
How to track django user details using zoho CRM? I am new zoho CRM, I got the few information and details how ZOHO CRm will be. Now I want to know one thing, I had implement the django project and also have a account in zoho CRM. Now I would like to Tacke all my user details from app database in zoho crm. how to export app database users to zoho CRM and how to track the user behaviour?
Django-allauth login on fb canvas
27,430,041
0
0
123
0
python,django,angularjs,facebook
The answer is yes. Just simply setup your fb canvas url to this: https://yourdomain.com/your-allauth-url/facebook/login/?process=login With this, your canvas app visitor will go through the allauth facebook login process. If the user has connected to your app it will redirect him/her to the login redirect url you have specified in your settings. Otherwise it will just ask him to allow the facebook connection.
0
0
0
0
2014-12-11T17:20:00.000
2
0
false
27,428,711
0
0
1
1
I've been trying to connect user on my fb canvas app. I've implemented django-allauth fb login on my website. In fb canvas app, I'm trying to get user as already logged in since user has already been connected on fb. Is there any way to make it using django-allauth?
How does django know which migrations have been run?
27,430,841
4
40
13,694
0
python,django,database-migration,django-migrations
If it is django1.7, it stores history to database, table django_migrations. South also stores migrations in database, and you can enable feature to show migration history in django admin.
0
0
0
0
2014-12-11T19:18:00.000
5
0.158649
false
27,430,688
0
0
1
2
How does django know whether a migration has been applied yet? It usually gets it right, but when it doesn't I don't ever know where to start troubleshooting.
How does django know which migrations have been run?
27,430,820
44
40
13,694
0
python,django,database-migration,django-migrations
Django writes a record into the table django_migrations consisting of some information like the app the migration belongs to, the name of the migration, and the date it was applied.
0
0
0
0
2014-12-11T19:18:00.000
5
1.2
true
27,430,688
0
0
1
2
How does django know whether a migration has been applied yet? It usually gets it right, but when it doesn't I don't ever know where to start troubleshooting.
Python bottle requests and unicode
61,842,769
0
8
3,378
0
python,unicode,bottle
in this case, to convert it ,I did like this search_field.encode("ISO-8859-1").decode("utf-8")
0
0
1
0
2014-12-11T20:56:00.000
2
0
false
27,432,211
0
0
1
1
I'm building a small RESTful API with bottle in python and am currently experiencing an issue with character encodings when working with the request object. Hitting up http://server.com/api?q=äöü and looking at request.query['q'] on the server gets me "äöü", which is obviously not what I'm looking for. Same goes for a POST request containing the form-urlencoded key q with the value äöü. request.forms.get('q') contains "äöü". What's going on here? I don't really have the option of decoding these elements with a different encoding or do I? Is there a general option for bottle to store these in unicode? Thanks.
Running Out of Threads: UWSGI + Multithreaded Python Application with GeventHTTPClient
27,436,888
1
1
777
0
python,multithreading,uwsgi,gevent
Mixing non-blocking programming (geventhttpclient) with blocking one (a uWSGI thread/process) is completely wrong. This is a general rule: even if your app is 99% non blocking it is still blocking. This is amplified by the fact that gevent makes use of stack switching to simulate blocking programming paradigms. This is like cooperative multitasking, and it is managed by the so called 'gevent-hub'. Unfortunately, albeit your greenlets will be able to make http requests they will be never terminated because the gevent hub will never run again once the request is over. If you want to maintain the geventhttpclient approach you have to set uWSGI in gevent mode, but you need to be sure that all the modules and techniques used by your app are gevent friendly.
0
1
0
0
2014-12-11T21:52:00.000
1
1.2
true
27,433,087
0
0
1
1
I'm currently running a python web API that is NOT multithreaded with much success on the uWSGI + NGINX stack. Due to new operational needs, I have implemented a new build that includes multithreaded requests to external data sources. However, when I deploy this new multithreaded build under uWSGI with --enable-threads, after a few minutes, the machine runs out of available threads. I was able to isolate the issue to my usage of geventhttpclient for my external HTTP requests by monitoring the thread count using ps -eLf | grep <process id>| wc -l. I have currently 2 worker threads (two external requests) in my application, so as I noticed, every time I hit/make a request from my API, the application thread use count increases by 2. If I swap my use of geventhttpclient with the standard python Requests module in just one of these worker threads, the thread count only increases by 1. NOTE: I am using HTTPClient.close() to close the connection within each thread. This leads me to suspect that geventhttpclient creates new threads that do not terminate when used in multithreaded uWSGI applications. Is there an easy way around this chokepoint? The performance of geventhttpclient is exceptional in non-multithreaded uWSGI applications, so I would love to continue using this. Thanks and let me know if I can provide any more information.
Manage.py runserver for demonstration
27,433,470
0
0
71
0
python,django
python3 manage.py runserver <your IP address>:8000
0
0
0
0
2014-12-11T22:14:00.000
2
1.2
true
27,433,412
0
0
1
1
How would I run a Django application on, a digitalocean droplet let's say, with just using the development server Django provides. I've tried just running python3 manage.py runserver, but I can't pull it up with the browser from another computer I know this is bad practice, but I really only need it up to demonstrate for a class project
django social auth get wrong access_token from google oauth2
27,487,490
0
0
123
0
python,django,google-oauth
all right. it turns out to be a problem of scope . the sample code set a default scope to mail.google.com while social-auth only have a default scope to read user information. the difference in length of token must be related to the scope
0
0
0
0
2014-12-12T01:15:00.000
1
0
false
27,435,367
0
0
1
1
I am integrating google oauth2 to my website using django social auth. The problem is that with django social auth , I get an access_token like ya29.2QCqpS-uKGXMNOP8yZnN6Z-F5LfVnyd7jwa8TaLP43nTEp2NUPB_p7Hi While with the code sample from google code the access token is like : ya29.2QCVXKc7XSNR3QxqRVAi0Z8Uz6mvolDGpezbZ9_r_oq7CXt01WvE9oUb90HXaynOLE4J8PjA5pzYDB The first one does not work while the second one works fine does anyone have any idea on this ?
How to change django version in PyCharm?
27,440,698
13
11
13,451
0
python,django,pycharm
Go to Settings->Project Interpreter. Double-click the Django package. Activate the check box Specify version and select the version you want. Press the button Install Package. Django will use pip in the background to install the package.
0
0
0
0
2014-12-12T09:26:00.000
7
1
false
27,440,489
1
0
1
2
I've installed new PyCharm that uses django v1.71(default), but I would like to change it to v1.68. How can we achieve this with PyCharm?
How to change django version in PyCharm?
34,903,153
2
11
13,451
0
python,django,pycharm
Go to file>>settings>>Project Interpreter and click the plus sign at the right edge of the popup window and look for django and install it. You need internet access though. It will install the new version.
0
0
0
0
2014-12-12T09:26:00.000
7
0.057081
false
27,440,489
1
0
1
2
I've installed new PyCharm that uses django v1.71(default), but I would like to change it to v1.68. How can we achieve this with PyCharm?
Jenkins : how to print the contents of a text file to the build log?
27,465,483
9
5
15,107
0
python,jenkins,jenkins-plugins
If your Jenkins is running on Linux, a simple "Execute Shell" build-step with cat filename.txt will print the file to console If running Windows, an "Execute Windows batch command" build-step with type filename.txt will do the same. The filename path is relative to WORKSPACE
0
0
0
0
2014-12-12T22:34:00.000
1
1.2
true
27,453,156
0
0
1
1
I have a non-deterministically working Jenkins build step that prints text. It's multi line and has lots of urls in it. It's a python build step. print("""\ xxxx yyy ") It works many times, but not all the times - it messes up the next step when it fails. I'm not sure how to debug, but maybe I should just add a step that displays the contents of a text file on the console output log. I can't find such a plugin? thank you!
Run Python script in background on remote server with Django view
27,461,927
2
1
1,029
0
python,django
I'd humbly reccomend the standard library module multiprocessing for this. As long as the background process can run on the same server as the one processing the requests, you'll be fine. Although i consider this to be the simplest solution, this wouldn't scale well at all, since you'd be running extra processess on your server. If you expect these things to only happen once in a while, and not to last that long, it's a good quick solution. One thing to keep in mind though: In the newly started process ALWAYS close your database connection before doing anything - this is because the forked process shares the same connection to the SQL server and might enter into data races with your main django process.
0
0
0
0
2014-12-13T13:29:00.000
3
0.132549
false
27,459,327
0
0
1
1
What I want to achieve is to run python some script which will collect data and insert it to DB in a background. So basically, a person opens Django view, clicks on a button and then closes the browser and Django launches this script on a server, the script then collects data in background while everything else goes on its own. What is the best library, framework, module or package to achieve such functionality?
Python/lxml: Retrieving variable data
27,468,960
0
0
57
0
jquery,python,xpath,lxml
What happens here is, upon selecting a value form the dropdown, an AJAX request is generated and gets the data. You can analyze the request url in your browser. If you use firefox, use firebug and take a look at the Net tab, what requests are generating and what is the url. In google chorme, look in Network tab. If you want to parse the data you have to make a request in that url.
0
0
1
0
2014-12-14T11:07:00.000
1
1.2
true
27,468,688
0
0
1
1
I want to parse some data from a website. However, there's a certain peculiarity: There is a dropdown list (layed out using div and child a tags, made functional with a jQuery script). Upon selecting one of the values, a subsequent text field would change its value. I want to retrieve the first dropdown value, and the respective text field, then the next dropdown value and the updated text field, and so forth. How would I go about this?
Interact with python script running infinitive loop from web
27,474,586
1
0
229
0
python,http,web,raspberry-pi
You have to write somewhere your configuration for looping script. So file or database are possible choices but I would say that a formatted file (ini, yaml, …) is the way to go if you have a little number of parameters.
0
0
1
1
2014-12-14T21:52:00.000
2
1.2
true
27,474,557
0
0
1
1
I have a python script on my raspberry-pi continuously (every 5 seconds) running a loop to control the temperature of a pot with some electronics through GPIO. I monitor temperature on a web page by having the python script write the temperature to a text file witch I request from java script and HTTP on a web page. I would like to pass a parameter to the python script to make changes to the controlling, like change the target temperature. What would be the better way to do this? I'm working on a solution, where the python script is looking for parameters in a text file and then have a second python script write changes to this file. This second python script would be run by a http request from the web page. Is this a way to go? Or am I missing a more direct way to do this. This must be done many time before and described on the web, but I find nothing. Maybe I don't have the right terms to describe the problem. Any hints is appreciated. Best regards Kresten
Sidebar Object on Sublime Plugin
27,475,157
0
0
70
0
python,sublimetext,sublimetext3,sublime-text-plugin
There is no sidebar API in Sublime currently, so unfortunately what you are trying to do isn't possible at present.
0
0
0
0
2014-12-14T21:53:00.000
1
1.2
true
27,474,576
0
0
1
1
I want to build a plugin in order to affect the sidebar. Mainly visual stuff at first. But I can't find any documentation about it. Is it possible, as we can obtain view() and window() in the plugin, to have something like sidebar(), and be able to treat all the nodes on the Folders sections (for individual files) and interact with them? Thanks!
Ejabberd server not getting started?
27,539,662
0
0
75
0
python-2.7,ubuntu-14.04,openfire,ejabberd
Solved the issue problem wan with my settings,and then restarted the server using sudo service ejabbers restart.It worked
0
1
0
0
2014-12-15T13:33:00.000
1
1.2
true
27,485,296
0
0
1
1
I have re-installed ejabberd server in my localhost.When i run sudo service ejabberd restart its no getting restarted.Instead its craeting error.The following error is shown in erl_crash.dump.All my configurations in conf file is correct. Kernel pid terminated (application_controller) ({application_start_failure,kernel,{{shutdown,{failed_to_start_child,net_sup,{shutdown,{failed_to_start_child,net_kernel,{'EXIT',nodistribution}}}}},{k I tried everything also killed process running on same ports.I there anything else to do to solve this issue ???
Runtime error alongside Django on Amazon AWS EC2 Linux AMI issue
27,500,649
1
0
274
0
python,linux,django,amazon-web-services,amazon-ec2
Just install blinker by typing pip install blinker in the console. Be sure you install it in your virtualenv if by any chance you use one, just by activating it before executing the pip command. You may also review your staging procedure to correctly install project dependencies.
0
0
0
0
2014-12-16T03:27:00.000
1
1.2
true
27,497,044
0
0
1
1
I am getting this error: signalling support is unavailable because the blinker library is not installed. I am running Django 1.6.5 under python 2.6.9. Is it possible that the error will go away if i update python on the server to 2.7.x? If so how can I update the server without losing everything I have done upto this point creating my website on the instance? Thanks so much in advance.
Is it possible to ensure audio isn't modified when playing back under Windows
27,499,520
2
1
39
0
python,windows,audio
Sound cards are for playing audio, not sending data. You can't rely on an arbitrary signal not being altered by the hardware, much less the software. For example, many sound cards have a capacitor in series with the output to filter out DC bias. If you try to pass a DC-biased (or very low frequency) signal through such a sound card, it will be distorted. And there's nothing you can do about it at the software level.
0
0
0
0
2014-12-16T07:05:00.000
1
0.379949
false
27,499,268
0
0
1
1
We have a python program which outputs specific waveforms over the audio to drive an LED, for an easy and cheap robot programming device. With the windows systems that we've tested everything works fine, but on some systems the waveform seems to be altered. We've used the control panel to disable any 'enhancements' for the audio output endpoint but it doesn't seem to help. So, is it possible, using python, to instruct Windows to play audio unchanged? Or do some of the audio gurus here have another theory of what could be affecting the audio?
scrapy debug Request object
27,499,859
3
4
764
0
python,post,scrapy
Use some traffic monitoring software , i personally use fiddler. it will help you to check the requests sent from python as well as from browsers
0
0
1
0
2014-12-16T07:24:00.000
2
0.291313
false
27,499,546
0
0
1
2
How to debug a scrapy Request object? requestobj= FormRequest.from_response(response, formxpath =form_xpath,callback=self.parse1) I need to check formdata of requestobj .But I didn't find any documentation for debugging Request object
scrapy debug Request object
27,615,272
1
4
764
0
python,post,scrapy
try sending request to: http://httpbin.org/ or http://echo.opera.com/ you will get a response with information your request
0
0
1
0
2014-12-16T07:24:00.000
2
0.099668
false
27,499,546
0
0
1
2
How to debug a scrapy Request object? requestobj= FormRequest.from_response(response, formxpath =form_xpath,callback=self.parse1) I need to check formdata of requestobj .But I didn't find any documentation for debugging Request object
Keeping custom module synced in OpenERP7
27,548,485
0
4
46
0
python,openerp,pycharm,openerp-7
Any change made directly in the OpenERP/Odoo GUI is not written back to the module and will overwritten in the next module upgrade. Use those direct changes only for experimenting or fast prototyping. Changes you mean to be final should always be made in your module files.
0
0
0
0
2014-12-16T16:16:00.000
1
0
false
27,509,088
0
0
1
1
SO i'm using Open ERP 7 and wanted to make a custom module. I've put everything into PyCharm to edit parts there, but sometimes I edit some forms or add some fields with in OpenERP itself under the Database structure. Any changes I make under the Database Structure (e.g adding a field) won't show up in my PyCharm. Is there a way to keep them both in sync? Thanks in advance