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
Mule Exception Payload
30,016,140
0
0
334
0
python,exception,flask,mule,payload
did you try with getExceptionMessage(). Note point here is when exception occurs payload will be lost in the mule message. You have to store payload in session var to get it during the exception case.
0
0
0
0
2014-09-16T13:31:00.000
1
0
false
25,870,184
0
0
1
1
I'm testing my REST API on Mule ESB, and when the API, implemented using Python Flask, returns a 200 http status Mule correctly exhibits the message returned (a JSON, as it is expecting). But when I return any other status, I can't seem to exhibit the message returned, which is a string. I'm trying to configure the exception thrown to show the original message returned by the API. How can I access it? I'm using Anypoint Studio. Thanks in advance.
Python and Django 1.7 I need to change the source of some of the supporting modules
25,871,179
3
0
53
0
python,django,pip,monkeypatching
Almost everyone's on GitHub these days. Fork the repos, make your changes, and point your requirements file to your forks. You might even want to make pull requests back to the maintainers, which will help these issues be fixed even more quickly.
0
0
0
0
2014-09-16T14:10:00.000
1
1.2
true
25,871,082
0
0
1
1
I've just upgraded to Django 1.7 and I've found that a couple of the modules we rely on which are installed by pip have small issues. I've played on a test box and found that each of these modules only needs a couple of lines to be changed to support Django 1.7. Both have import errors which are easily fixed. What would be the best way to make a temporary patch to these files? Ideally I would like the fix to live with my project until updated modules appear and I can remove it. We're running puppet on the production systems so I could just overwrite the two files with new versions but this seems too easy to lose track of. Monkey patching might work, but as they are import errors I'm not sure how to cut this out before it fails.
Not using "admin interface" is a barrier for developing with Django?
25,871,904
0
0
229
0
python,django,python-2.7,flask,tornado
Disclaimer: questions like "what framework is better" often doesn't have exact answer. It depends on many factors, and one of them is personal preference. So below is just my opinion. I think, that django is the best choice in case you don't have strong arguments for other frameworks. Even if you don't plan to use it's built'in admin part. Yes, Flask is simpler. But, django has more community, has more batteries. Also, django will restrict your project architecture. I.e., you'll have to follow some approaches and project structure, that django provides. Someone can say, that it is bad. Well, maybe. But if you are new in python and web development, better follow it. Django is developed and maintained by good programmers. So, you will learn good patterns from working with it.
0
0
0
0
2014-09-16T14:34:00.000
2
0
false
25,871,611
0
0
1
2
We are up to developing an "accounting software" with Python. The software will based on SOA (rest) and hosted on cloud. We are actually PHP developers but we'd like to switch Python for our future software. Our Python experience is 3 months and we developed a mid-sized social media software with Python / Tornado. After googling about Python frameworks, we decided to use Django because it covers the libraries that we want to use as ORM, forms etc. and we think that it's communutiy is quite good compared with Flask. Django presents an admin interface which we will NOT be using it. We'd like to develop our own class generators to create forms etc. Some say that "if you won't use Django admin interface, you'd better to choose Flask instead. Because it is more minimal and easy to use for Phyton beginners. Therefore we are confused. Any help would be appreciated.
Not using "admin interface" is a barrier for developing with Django?
25,872,121
1
0
229
0
python,django,python-2.7,flask,tornado
It's certainly not the case that the only benefit from Django is the admin. As you say, there are many good features: the ORM, template language, forms, authentication, and especially the third-party ecosystem are all great reasons to use Django. Now you can get all those same features with Flask if you're prepared to do some integration work, but the argument can just as easily be made that Django is better for beginners precisely because it does come with all those things built-in.
0
0
0
0
2014-09-16T14:34:00.000
2
1.2
true
25,871,611
0
0
1
2
We are up to developing an "accounting software" with Python. The software will based on SOA (rest) and hosted on cloud. We are actually PHP developers but we'd like to switch Python for our future software. Our Python experience is 3 months and we developed a mid-sized social media software with Python / Tornado. After googling about Python frameworks, we decided to use Django because it covers the libraries that we want to use as ORM, forms etc. and we think that it's communutiy is quite good compared with Flask. Django presents an admin interface which we will NOT be using it. We'd like to develop our own class generators to create forms etc. Some say that "if you won't use Django admin interface, you'd better to choose Flask instead. Because it is more minimal and easy to use for Phyton beginners. Therefore we are confused. Any help would be appreciated.
Django session scope
25,891,456
0
0
684
0
python,django,session,satchless
You haven't shown any code at all, which would have been helpful. But I expect the problem is that you're not passing the request object to the template context in your "home" view: usually this happens automatically if you are using a RequestContext or the render shortcut, which presumably you are doing in the other views.
0
0
0
0
2014-09-17T11:42:00.000
1
1.2
true
25,889,636
0
0
1
1
I'm currently developing an e-commerce website using Django 1.6 and Satchless. I have two applications in my project: home and nos_produits. I'm trying to store the satchless cart object in the django session in order to display the related informations in my templates. Everything works fine in the scope of my application nos_produits (where I add my cart object to the session) but when I navigate through the application "home" it seems that my cart object doesn't exist in the session, i.e {% if 'cart' in request.session %} is not evaluated to true. So my question is what's exactly the scope of a session in django. Is it limited to the application scope where the session is set or to the whole scope of the project? Thanks in advance. EDIT Found the problem: in my "home" view I used render(request, myTemplate.html) instead of using render(request, myTemplate.html, locals())
Weasprint and Twitter Bootstrap
25,938,231
0
0
512
0
python,twitter-bootstrap,pdf,flask,weasyprint
I figured out what the problem was. When I declared the style sheet i set media="screen", I removed that tag element and it seemed to fix it. Further research indicated I could also declare a separate stylesheet and set media="print".
0
0
0
1
2014-09-17T22:48:00.000
1
1.2
true
25,901,582
0
0
1
1
Does anybody have any experience rendering web pages in weasyprint that are styled using twitter Bootstrap? Whenever I try, the html renders completely unstyled as if there was no css applied to it.
DJANGO default/error url
25,908,284
0
0
59
0
python,django,url-pattern
You should create 404.html file inside your TEMPLATE_DIRS path
0
0
0
0
2014-09-18T08:53:00.000
2
0
false
25,908,254
0
0
1
1
Is there a way for an url in django to be triggered when no pattern matched the url requested by the client, something like: defaulturl = "/path/to/default/page" errorpage = "/path/to/error/page" Thank you!
Testing an ORM for RethinkDB
25,922,468
3
3
484
1
python,unit-testing,testing,orm,rethinkdb
You can create all your databases/tables just once for all your test. You can also use the raw data directory: - Start RethinkDB - Create all your databases/tables - Commit it. Before each test, copy the data directory, start RethinkDB on the copy, then when your test is done, delete the copied data directory.
0
0
0
1
2014-09-18T15:32:00.000
1
1.2
true
25,916,839
0
0
1
1
I am close to finishing an ORM for RethinkDB in Python and I got stuck at writing tests. Particularly at those involving save(), get() and delete() operations. What's the recommended way to test whether my ORM does what it is supposed to do when saving or deleting or getting a document? Right now, for each test in my suite I create a database, populate it with all tables needed by the test models (this takes a lot of time, almost 5 seconds/test!), run the operation on my model (e.g.: save()) and then manually run a query against the database (using RethinkDB's Python driver) to see whether everything has been updated in the database. Now, I feel this isn't just right; maybe there is another way to write these tests or maybe I can design the tests without even running that many queries against the database. Any idea on how can I improve this or a suggestion on how this has to be really done?
Can I run Python 2.7 Libraries (Impacket, Pcapy) on Django
25,932,635
1
0
151
0
python,django,flask
You can run anything from Django, it just provides a framework to get stuff to the web. As long as the Django application is running as a user which has privileges to access your NIC there won't be an issue with that. You can simply call your code you already have from the Django Views. The time this stuff takes may be too long for a web request so you may need to pass some stuff down a message queue and look up the results. Look at Celery for that purpose. I do prefer Flask over Django but it doesn't matter what you use. Just remember Django is another library it all still runs inside Python :)
0
0
0
0
2014-09-19T04:28:00.000
1
1.2
true
25,926,384
0
0
1
1
Hi I just want to ask if its possible to run Impacket to Django, On my project I am already done on my sniffing and parsing using Impacket and Pcapy but my clients requested that the GUI will be web based. I picked Django because its the most widely used and all but I am having doubts that it can run my Libraries. For starters can Django open my NIC in Ubuntu and have access to sniff on it? or is it better for me to use Flask for from what I read flask is being run on the Python Console Application, from what I understood I will install a HTTP Server in the Project then the Python Console will be like a Controller (MVC) to my GUI which is Flask.
Avoiding Exception Value: maximum recursion depth exceeded while calling a Python object in Django signals
25,955,108
0
1
478
0
python,django
Alter your need. "Overcoming" the recursion would just mean that you succeed at creating infinite objects, which is inadvisable. If what you really need is to create a second Invoice only when the first one was created manually, well, that's different. Make your function do nothing unless the sender is manually-created. If you really can't tell the difference between manual and automatic, add a field that tells you. (Though surely there's something unique about the automatic objects, or you wouldn't need to create them!)
0
0
0
0
2014-09-21T02:01:00.000
1
1.2
true
25,955,073
1
0
1
1
I need to create an invoice object whenever an invoice is created from inside post_save.connect(after_saving_invoice, sender=Invoice). This is causing Exception Value: maximum recursion depth exceeded while calling a Python object. The reason of the exception is clear but how can I overcome it?
Display the number of duplicate requests filtered in the post-crawler stats
25,967,819
0
1
108
0
python,scrapy
You can maintain a list of urls that u have crawled , whenever you came across a url that is already in the list you can log it and increment a counter.
0
0
1
0
2014-09-22T01:33:00.000
1
0
false
25,965,606
0
0
1
1
One of the Scrapy spiders (version 0.21) I'm running isn't pulling all the items I'm trying to scrape. The stats show that 283 items were pulled, but I'm expecting well above 300 here. I suspect that some of the links on the site are duplicates, as the logs show the first duplicate request, but I'd like to know exactly how many duplicates were filtered so I'd have more conclusive proof. Preferably in the form of an additional stat at the end of the crawl. I know that the latest version of Scrapy already does this, but I'm kinda stuck with 0.21 at the moment and I can't see any way to replicate that functionality with what I've got. There doesn't seem to be a signal emitted when a duplicate url is filtered, and DUPEFILTER_DEBUG doesn't seem to work either. Any ideas on how I can get what I need?
Is there a way to select more than one option in django admin filters?
25,978,053
0
2
495
0
python,django,django-admin
For your first question: I think it's possible. I've made a quick test on the admin interface for Users, and if you play with the URL querystring, you can combine filters : /admin/auth/user/?is_superuser=1&is_superuser=0 will list both super and non-super users. You'll have to override admin filters template to generate proper URLs for your needs, though. I don't understand your second question. What do you mean by combined ? If you select an item in the first filter and an item in the second one, you will have combined filtering, won't you ?
0
0
0
0
2014-09-22T04:14:00.000
1
1.2
true
25,966,602
0
0
1
1
I actually have two questions, please answer what you can: Question 1: In django admin, if you have list_filters = ["book"], and your options were "red carpet" & "Bingo the Dinosaur", you can only select one book at a time; either "red carpet" or "Bingo the Dinosaur". Is there a way to make it so that the user can select both at the same time? Question 2: In django admin is there a way to combine list_filter fields? so if you have list_filer = [" bookname", "bookauthor"], is there a way to make it so that the book name and author are combined in one filter and you search it at the same time?
User data through Google APIs without authorization flow
26,019,429
0
0
664
0
heroku,google-api,google-calendar-api,google-authentication,google-api-python-client
So, you want to be remembered. If you want to dispose of any kind of authenticacion but yet the user needs to be recognized you should be using a cookie. On the server side that cookie should be used to select the offline token. Of course, without that cookie the user needs to be authenticated in any way. I would make them reauth by Google so you get a new offline token. Hope that it helps.
0
0
0
0
2014-09-23T00:28:00.000
2
0
false
25,985,069
0
0
1
1
I'm writing a web application that reads my personal calendar data, crunches stats, and then spits them out for the world to see. I don't need an authorization flow. Is it possible to leverage the Google APIs without going through a user sign-in flow? In other words, I want my personal Google account permanently and securely signed in to my server without the risk of my token invalidating or having to re-auth. Right now I'm signing myself in with an offline token, then uploading the authorization file onto my server, basically spoofing the server that I already auth'd. Is there not a cleaner way? I've spent hours reading through the API docs and Auth docs, but haven't found and answer. If there is a page I've missed, please point me to it! PS. I'm using the Calendars API through Python/Flask on Heroku, but that shouldn't matter.
Better to maintain a list in datastore or csv file?
25,990,090
0
0
98
0
python,google-app-engine,google-cloud-datastore,app-engine-ndb
As I know get_by_id() (small) operations are free of charge. So you will pay only for instance hours. But I think it would be better to store subscription emails in another kind, because storage is cheap, and denormalization of data is a good practice on GAE. Anyway CSV does not looks like a good idea.
0
0
0
0
2014-09-23T07:46:00.000
2
0
false
25,989,667
0
0
1
1
I want to maintain an email blacklist of people who don't want to ever receive email from my service. Before I send each email, I want to do a lookup on whether the recipient is in the list. Which of 2 choices is better? I can create a BlacklistEmail model in datastore and key it on the email address so I can have faster lookups using get_by_id(). In 99% of cases, the recipient will not be in the blacklist so this would actually cost a read as it would not hit memcache. I can store the blacklisted email in a csv file and check whether the recipient is in the list. This seems like it wouldn't cost anything, but I am not sure about performance. I don't expect the list to be very big. Any other better way? Which is better in terms of cost and performance?
dev_appserver.py doesn't load appengine_config.py
25,990,536
3
5
698
0
python,google-app-engine
I had the same problem before. Solved by changing the loading method in app.yaml to wsgi, for example, from: script: my_app/main.py To: script: my_app.main.application Let me know if it works for you.
0
1
0
0
2014-09-23T08:06:00.000
1
1.2
true
25,990,036
0
0
1
1
I have an App Engine app running locally using dev_appserver.py. In the app directory I have the standard appengine_config.py that is supposed to execute on every request made to the app. In the past it used to execute the module, but suddenly it stopped doing it. In another app runs on the same machine it works fine. I checked with Process Monitor to see if the file is loaded from another location, but it's not (I can see the other app's file being loaded). Any ideas why appengine_config.py is not executed?
Edx Studio not showing with a theme
26,646,633
0
0
276
0
python,django,django-templates,mako,edx
port 18010 is forwaded via nginx, So you have to run studio collectstatic. ie..update_assets for cms(studio) in edx.
1
0
0
0
2014-09-24T07:59:00.000
2
0
false
26,011,567
0
0
1
1
The Studio app that is served on port 18010 shows with no theme. It only shows black text on a white background and with no images... that happens while the other counterpart LMS (on port 80) app shows fine. Where shall I start troubleshooting this problem?
Why is Django creating my TextField as a varchar in the PostgreSQL database?
26,030,265
1
2
1,186
1
python,sql,django,postgresql,psycopg2
I'm not sure what the exact cause was, but it seems to be related to django's migration tool storing migrations, even on a new database. What I did to get this behavior: Create django project, then apps, using CharField syncdb, run the project's dev server kill the devserver, modify fields to be TextField Create a new Postgres database, modify settings.py Run syncdb, attempt to load fixtures See the error in question, examine db instance What fixed the problem: Create a new database, modify settings.py delete all migrations in apps/migrations folders after running syncdb, also run createmigrations and migrate The last step generated a migration, even though there were none stored in the migrations folder, and there had been no changes to models or data since syncdb was run on the new database, which I found to be odd. Somewhere in the last two steps this was fixed. Future people stumbling upon this: sorry, I'm not going to keep creating django projects to test the behavior further, but perhaps with this information you can fix your own database problems.
0
0
0
0
2014-09-24T23:35:00.000
1
1.2
true
26,028,200
0
0
1
1
Django 1.7, Python 3.4. In my models I have several TextFields defined. When I go to load a JSON fixture (which was generated from an SQLite3 dump), it fails on the second object, which has 515 characters for one of its fields. The error printed is psycopg2.DataError: value too long for type character varying(500) I created a new database (not just a table drop, a whole new db), modified my settings.py file, ran manage.py syncdb on the new database, created a user, and tried to load the data again, getting the same error. Upon opening pgAdmin3, all columns, both CharField and TextField defined are listed as type character var. So it seems TextField is being ignored and CharFields are being created instead. The PostgreSQL documentation explicitly lists both text and character types, and defines text as being unlimited in length. Any idea why?
How to post a form to django site, securely and from another site
26,081,085
1
0
389
0
javascript,python,django,forms,security
I have a django app which need to receive post requests from another site using html+javascript. You don't have to ! You can build an API instead ;) You create an API call - small site calls the API of main site. In that situation, the form is handled by a view in small site and the API is called via the server. Check out Django REST Framework. Note: That solution wouldn't stop you from using AJAX but it would avoid cross domain issues.
0
0
0
0
2014-09-28T01:13:00.000
1
0.197375
false
26,080,694
0
0
1
1
I have a django app which need to receive post requests from another site using html+javascript. For example i have mydjangosite.com and smallhtmlsite.com What i want is : user visit smallhtmlsite.com and fill a form, then he pushing submit button and mydjangosite.com receive request and create objects(form saving models actually). So i will have a view which will handle this requests. But how can these been done securely?
When using a flask application does using print negatively affect performance?
26,085,702
2
1
349
0
python,logging,heroku,flask
Both outputs (print and logger) end up in a file, the only difference is that a logger typically allows for some filtering of the output and tries to add as little overhead as possible when messages are filtered out. This means its not possible to say without testing, IE comparing the two. You should be able to use the timeit module to time how long it takes to execute a for loop that prints a thousand or million messages. However, the other issue is concurrency: if your flask app is run by separate clients, the performance impact of log vs print may be different depending on how the log is designed vs the capture of print statements. This is harder to test but my guess is you could create a script that uses the multiprocessing module to run a wad of requests in parallel to a flask URL that just has one print/log message, and meadure how many requests your test client is able to make in a given amount of time. The final consideration is that the amount of processing in your flask view/render may be significantly larger than time it takes to either log or print. Eg if your render without any prints takes 100ms, and with print it takes 110ms, then what does it matter that log is twice as fast as print (IE 105ms instead)? As long as you remain frugal in your use of print/log, it won't matter much. This always applies, in any app, not just web.
0
0
0
0
2014-09-28T04:32:00.000
1
1.2
true
26,081,637
0
0
1
1
I've deployed an flask app on heroku and since it's relatively small I never bothered to setup the logger. I have found by using a print statement I can see everything I need on one of herokus add-on loggers. What I'm wondering is does that negatively affect performance vs had I just used the built in logger in flask? Does the print statement add unnecessary overhead to a python program?
How can I get the "old" zip() in Python3?
26,090,123
8
6
4,304
0
python,django,python-3.x
Just make a list of the result by doing list(zip(...)).
0
0
0
0
2014-09-28T22:02:00.000
1
1.2
true
26,090,117
1
0
1
1
I migrated from Python 2.7 to Python 3.3 and zip() does not work as expected anymore. Indeed, I read in the doc that it now returns an iterator instead of a list. So, how I am supposed to deal with this? Can I use the "old" zip() in my Python3 code? Find bellow the way it worked before in a Django project: in views.py: my_zipped_list = zip(list1, list2) in file.html: {{ my_zipped_list.0.1 }} Maybe another solution would be to keep "new" zip() behaviour and change template instead. Thanks for help!
Want to create a new application for website traffic monitoring ( analysis )
26,095,512
1
0
153
0
javascript,python,django,node.js,evercookie
You will have to break down your application as it is a humongous task to create something like GA. You will have to track many user activities(click,spend time etc).so you can do that in plain js or use a cross-platform lightweight library(angular.js) that can make your life a little easy. Now since you will have to send large set of traced data to you database with minimum latency,use Node.js in this scenario.Simple Ajax call would also work but then it would be very slow. Now comes your database.Prefer NoSql since it suits your requirement of unstructured data ,preferrablly MongoDb which can help you with its own mapReduce,large storage capacity .Since there will be lot of calculation involved you can use your python knowledge which can help you process data a lot faster.you can use other languages as well(eg.Go) Your processed data and results can then be stored in Redis(which acts as a caching layer). you can use sophisticated graphic library like d3.js,Highcharts.js for displaying Graphical data on the client-side. There are a lot of factors that can be involved.This is just a very basic outline of what you could do.
0
0
0
0
2014-09-29T08:03:00.000
1
1.2
true
26,095,180
0
0
1
1
I want to create my own application for monitoring traffic of my website without using any third party tools like google analytics. In which I want to log screenshots, user details, page details and cookies. So what technology should I opt so as to achieve this goal and which will be best suited and what work flow should I follow. I've never done this kind of work previously so I'm new to this. Any help would be greatly appreciated. The technologies I know are : javascript, nodejs, django(python).
how do i configure python/flask for public access with windows firewall
28,746,633
1
3
8,285
0
python,flask,windows-firewall
When running as a service the program running the service is not python.exe but rather pythonservice.exe. You will have to add that to the allowed programs in the Windows Firewall Setup. In my case it is located under C:\Python33\Lib\site-packages\win32\pythonservice.exe.
0
0
0
0
2014-09-29T14:49:00.000
2
0.099668
false
26,102,680
0
0
1
1
We have developed an app in python and are using flask to expose its api via http requests. all this on WINDOWS - Everything works ok and we have tested in-house with no problems and we are now trying to use the app in the real world - we have gotten our IT dept to give us a public facing ip/port address (forwarded through a firewall ??) and now we can't access the server/app at all. After a bit of digging, we've found the problem has something to do with the Windows Firewall configuration, when its on it won't work, when its off everything is fine. the flask app code is run like so: app.run(debug=False, host='0.0.0.0', port=8080) the port 8080 is setup in the Firewall Exceptions as is python.exe in the Program Exceptions netstat -a shows the app is sitting there awaiting connection. If I try to access the site though chrome I get the error: ERR_CONNECTION_TIMED_OUT. With the firewall on i'm never seeing any "hits" come through to the app at all. Is there some other configuration I'm missing? Many thanks.
use dev_appserver.py for specific file in a directory
26,136,777
1
0
52
0
python,google-app-engine,cmd
dev_appserver doesn't "run a file" at all. It launches the GAE dev environment, and routes requests using the paths defined in app.yaml just like the production version. If you need to route your requests to a specific Python file, you should define that in app.yaml.
0
1
0
0
2014-10-01T07:53:00.000
1
1.2
true
26,136,643
0
0
1
1
In order to start Google app engine through the cmd i use: dev_appserver.py --port=8080, but i can't figure how does it pick a file to run from the current directory. My question is, is there an argument specifying a file to run in the server from all possible files in the directory?
WLST - force stop application
26,177,888
1
1
3,907
0
java,python,weblogic,weblogic-10.x,wlst
Try again without the options. Just the stopApplication(appName). This is what the admin console does, kills all existing sessions and drags it to prepared state. You are trying to stop it gradually and hence the delay. You had mentioned, "when one of this application fail to deploy for X/Y reason, I just want to force stop this application and to pass to the other one." If an application fails to deploy, you should not have to stop it. If the App runs, its successful correct?
0
1
0
0
2014-10-01T08:06:00.000
1
1.2
true
26,136,844
0
0
1
1
I am currently working with weblogic and the thing is that I deploy several applications on my weblogic server. Sadly, when one of this application fail to deploy for X/Y reason, I just want to force stop this application and to pass to the other one. I've already looked into the WLST doc and I don't find what I am searching for. Here is the function I use : stopApplication(applicationName, gracefulProductionToAdmin="true", gracefulIgnoreSessions="true") It takes about 5 minutes to stop application this way. When I stop application through Administration Console (force stop actually) it takes about 5 seconds to stop application. So is there any way to force stop application through WLST script? Thanks
Python/Django get country flag from IP
26,143,098
0
0
1,719
0
python,django,geodjango,django-countries
Personally I would set a generic flag as a fallback (django flag perhaps?) if user does not set their country, and to be fair there must be a reason if user doesn't. Or you can simply make that country field mandatory. And assuming that person in that country based on their existing IP just doesn't sound right. Imagine if you are working remotely via VPN or behind a proxy server... you get the idea. It makes more sense if you just want to redirect people to sub-domain (different language) site base on IP.
0
0
0
0
2014-10-01T13:23:00.000
2
0
false
26,142,468
0
0
1
1
I am using django-countries to get a flag from the CountryField and it works. However, some users don't have a country set on their profiles, but I still have to display a flag. My idea was to get a country from IP and then get a flag from the country or anything similar to that. Unfortunately, this is not happening in the view, so I don't have the request. I can set the IP in the template and then, in the backend, check if no flag was found (if a country is not provided) and then somehow use the IP that I got from the template to get a flag. Is something like that possible? If needed, GeoDjango is already included in the project. Perhaps there is a totally different way of doing this, but I am new to Django and still learning. Thanks.
django multiple database for multiple organisation in a single project
26,158,170
1
0
181
1
mysql,django,python-2.7
It doesn't make sense to create a new database for each organization. Even if the number of customers or organizations grows to the hundreds or thousands, keeping data in a single database is your best option. Edit: Your original concern was that an increase in the number of organizations would impact performance. Well then, imagine if you had to create an entire database for each organization. You would have the same tables, indexes, views, etc replicated n-times. Each database would need system resources and disk space. Not to mention the code needed to make Django aware of the split. You would have to get data from n databases instead of just one table in one database. Also keep in mind that robust databases like PostgreSQL or MySQL are very capable of managing thousands or millions of records. They will do a better job out of the box than any code you may come up with. Just trust them with the data and if you notice a performance decline then you can find plenty of tips online to optimize them.
0
0
0
0
2014-10-02T09:07:00.000
1
0.197375
false
26,157,625
0
0
1
1
In my project there is two models ,ORGANISATION and CUSTUMER .Here what i am doing is while i am adding new customer to the organisation i save the organisation_id to the table CUSTOMER .But now i am worrying about the performance of my project when the database becomes huge. So now i am planning to create new database for every newly creating organisation .And save all the information of the organisation in that organisation's database. But i don't know how to create a new database for every newly creating organisation.And i'd like to know which method is better in performance.Please correct the question if not.
Get the current company without ids or uid in Odoo / OpenERP
26,207,355
1
1
5,993
0
python,openerp,openerp-7
Not sure I completely understand your question. A user may be able to do something in any company depending on their list of allowed companies, but a user can only ever do something in one company at a time. Any user can change their current company to one of the companies they are allowed but when they do this, the company_id on the user record is changed so if you browse res.users using the UID you will always get the current company of the user. The only exception I can think of is if you give the user a list of companies they are allowed to see and give them a button or check box to do something on that company. In this case, your screen will need to be backed by a model and you can check on there so see which company they chose, either by browsing to see which record has the checkbox set, or if you put a button or action on a tree view, the method will get the IDs of the records selected.
0
0
0
0
2014-10-02T16:29:00.000
2
0.099668
false
26,165,247
0
0
1
1
I need to create a function that takes a default value, this value is distinct for each company. Thing is that I can't use the uid because the user can do this in any company, and I have no object to ask ids for because its for a default field. Is there any way to get the current company without using ids or the uid ? Thanks in advance.
Python - install Pillow and MySQL-python on 1and1 hosting
26,166,726
0
0
390
0
python,mysql,django,pillow
There's not really enough detail here to help. But one possibility is that you don't have the development package for python installed. If you are using Debian or Ubuntu, you can do sudo apt-get install python-dev to install it.
0
0
0
0
2014-10-02T17:15:00.000
1
0
false
26,166,024
1
0
1
1
I've created python virtual environment, installed django using pip and now I would like to install Pillow and MySQL-python using pip but it fails during compile process. (starting with python.h no such file or directory) Has anyone tried intall some of these on 1and1 hosting ? Maybe compile it on different machine or other solution ?
Django sqlite3 database dump
26,179,396
0
0
1,114
1
python,django,database,sqlite
You could also use fixtures. And generate fixtures for your app. Dependes on what you're planing to do with them. You'll just make a loaddata after that.
0
0
0
0
2014-10-03T12:07:00.000
2
0
false
26,178,633
0
0
1
1
How can i create Django sqlite3 dump file (*.sql) using terminal? There is a fabric fabfile.py with certain dump scripts, but when i try to use fab command next massage shows up: The program 'fab' is currently not installed. To run fab please ask your administrator to install the package 'fabric'. But there are fabric files in /python2.7/site-packages/fabric/. I'm not good at Django and Python at all. The guy, who was responsible for our Django project, just left without any explanations. In general i need to know how to create Django sqlite3 dump file (*.sql) via terminal. Help? :)
How do I duplicate an appengine app
26,194,692
1
0
59
0
python,google-app-engine
You could create a new application, use Datastore Admin to copy your entities to the new application's Datastore, then re-deploy your application. Is there anything else that needs duplicating?
0
1
0
0
2014-10-04T00:47:00.000
2
0.099668
false
26,188,548
0
0
1
2
I want to backup my python app and restore it to a different app on Appengine. In the Application Setting Page, under Duplicate Applications, I add a new application identifier. When I click the Duplicate Application button, I get this error: "The developer does not own the app id being forked". Further research indicates that this seems to be a bug, but that a workaround is to send an email invitation to the other email addresses in my Google account to add them. I am able to send those emails from the Permissions screen by clicking a button and inserting the email address. When I click link in the email that is sent, it opens My Applications, listing all my apps, instead of a confirmation that my response. It appears to open the wrong page. In the Permissions page, the email address still shows Pending after about 10 hours. Is there a simple way to duplicate an application?
How do I duplicate an appengine app
26,194,002
1
0
59
0
python,google-app-engine
Do you have more than one google account? I have found that app engine does unexpected things when you are logged into more than one google account at a time. I suggest logging into only a single google account and trying the operations again.
0
1
0
0
2014-10-04T00:47:00.000
2
0.099668
false
26,188,548
0
0
1
2
I want to backup my python app and restore it to a different app on Appengine. In the Application Setting Page, under Duplicate Applications, I add a new application identifier. When I click the Duplicate Application button, I get this error: "The developer does not own the app id being forked". Further research indicates that this seems to be a bug, but that a workaround is to send an email invitation to the other email addresses in my Google account to add them. I am able to send those emails from the Permissions screen by clicking a button and inserting the email address. When I click link in the email that is sent, it opens My Applications, listing all my apps, instead of a confirmation that my response. It appears to open the wrong page. In the Permissions page, the email address still shows Pending after about 10 hours. Is there a simple way to duplicate an application?
Append choices to choice list in Django models dynamically
26,194,172
1
0
785
0
python,mysql,django
I think your choice of type field is incorrect. Basically CharField with choices has limited functionality and you can't do this with it you can only filter the choices you declared initially but you can't add new ones on the fly (you will see them but they will not pass the field validation). I think you should go with ForeignKey where you do not have such limitations. You can build it dynamically without ptoblems. I can't tell you the queries without seeing some code.
0
0
0
0
2014-10-04T04:17:00.000
1
0.197375
false
26,189,557
0
0
1
1
I want to select the options from a list in my django models. But the options in the list are populated in the post_save() method.The situation is like this: I enter some attributes in the table1 based on which the value of other attributes of the table is calculated using different algorithms in post_save() method. Now I want these values from different algorithms to be shown as choices to the attribute(which were set to blank intially or some default value) of table1 after saving it for the first time. There are constraints only distinct values should as choices and the choice list should contain only those values which are calculated using the attributes of this tuple/row of the table. I tried to use choice option and appending the values from diff algos to the list but that creates two problems: If I save two entries then the list contains the values that are calculated using the attributes of both the entries(filtering required) If I save a entry twice then the duplicate entries are appended to the list. Also foreign key may be a option but how to filter foreign key according the tuples which generated it. I tried to explain the problem and I feel code is not required. Comment if any details required in regard to question.
Is there a ways to take out the artist and song from the array?
26,199,110
0
0
27
0
python,python-2.7
Assuming this array is a string array of x strings, you can create a substring from the index of the second instance of '|' to the end of the string.
0
0
0
0
2014-10-05T02:30:00.000
1
0
false
26,199,088
0
1
1
1
Suppose you have this type of array (Sonny Rollins|Who Cares?|Sonny Rollins And Friends|Jazz| Various|, Westminster Philharmonic Orchestra conducted by Kenneth Alwyn|Curse of the Werewolf: Prelude|Horror!|Soundtrack|1996). Is there any possible way to only take out Sonny Rollins and Who cares from the array?
Execute the script in command line or in Rest client
28,648,892
0
1
663
0
java,python,web-services,architecture
I would personally recommend wrapping the Python code in an HTTP layer and turning it into a REST web service. I don't doubt that many successful applications have been written by calling scripts from the command line, but I think there are a couple things that are really nice when it comes to the freedoms of a web service. It definitely seems like putting the Python app in a web service would be the more 'Service-oriented' way to do it, so it seems reasonable to expect that doing so would give you the typical benefits of SOA. This may or may not apply to your situation, but if none of these considerations apply that seems to point towards this being a 'neither choice will be that bad' situation. The biggest thing I see going for using the web service is scalability. If the command line application can chew up a lot of server resources, it would be good to have it running on a separate server from the web application. That way, other users who aren't using the part of the application that interacts with this Python app won't have their experience reduced when other users do things that cause the Python app to be called. Putting the Python code behind a web service would also make it easier to cluster. If it's a situation where you could get some benefit from caching, it would also be easy to take advantage of the caching mechanisms in HTTP and your proxy servers. Another thing that might be nice is testability. There's a lot of good tools out there for testing the common cases of a web application talking to a web service, whereas thoroughly testing your applications when they're just calling command line applications might be a little more work.
0
0
1
0
2014-10-07T12:21:00.000
2
0
false
26,235,884
0
0
1
2
I have a java web application that needs to make use of a python script. The web application will give the script a file as input and take some text as output. I have two options: Wrap the python script with HTTP and call it from the web application as a REST service Simply execute command line from the web application Which option should I take and why? This script won't be used by any other application.
Execute the script in command line or in Rest client
26,236,230
0
1
663
0
java,python,web-services,architecture
Try both things but try to execute in command line to know the output line by line. you can find any error in the line when that line will execute while at rest service it will return you an Http response.
0
0
1
0
2014-10-07T12:21:00.000
2
0
false
26,235,884
0
0
1
2
I have a java web application that needs to make use of a python script. The web application will give the script a file as input and take some text as output. I have two options: Wrap the python script with HTTP and call it from the web application as a REST service Simply execute command line from the web application Which option should I take and why? This script won't be used by any other application.
authentication on webserver
26,238,910
2
0
50
0
php,python,django,web-frameworks
You can use any of these framework since the have authetications nativly implemented but you don't need to, you can build your own authentication system: You will need a database/file to store credentails and a authentication program verifying credentials against this given storage in any language your webserver can use. However I would strongly recommend you to use an established framework for authetication.
0
0
0
1
2014-10-07T14:14:00.000
1
1.2
true
26,238,097
0
0
1
1
on my beaglebone i have installed hostapd, iscdhcp and lighttpd so i can build a router and webserver. let say my network is not secured so every on can be connected to it, and will get an ip-address from the beaglebone-server. After the person is connected to the network and he starts a browser he should be redirected to a homepage to give his password, if he is not authenticated yet. do i need a webframe-work (like django) for this purpose?? if not what else?? i am familiar with programming in python, php, html and java. thanks
How can I save every Outlook Express Email as an html without clicking "Save As" for every email
26,245,689
1
0
123
0
javascript,python,html,email,outlook
Outlook Express, unlike real Outlook, does not provide any API to enumerate its messages. The only API exposed by OE is Simple MAPI.
0
0
0
1
2014-10-07T21:18:00.000
1
1.2
true
26,245,476
0
0
1
1
I am trying to save a whole slew of emails as html in Outlook Express, but the program only lets me save them individually. If I click "Save As" on more than one email Outlook only lets me save them all in one .txt file. I was able to drag all of the files into a folder outside of outlook, but their file type is Outlook Item. Thus, I am trying to find a way to save all of these files in html. I have looked at a number of programs, such as SAFE PST Backup, but they didn't seem to have this functionality. If there were a way to do this in either Python or JavaScript that would be awesome, but I'm not sure where to start.
Using Django Settings to cache a timestamp
26,723,457
0
0
129
0
python,django,django-settings
So the short answer to this question: Do not store global runtime data in Django's settings. Each new process thread will create its own instance of settings, meaning that your application will behave differently in each thread, or you'll have to run your app in single threaded mode (bad for performance). If you need to store this kind of data either use the Django Caching Framework, a database or the filesystem.
0
0
0
0
2014-10-08T00:15:00.000
1
1.2
true
26,247,293
0
0
1
1
I want to use the Django Settings to indefinitely store a value. This value will change throughout the life span of the server process and should not be forgotten. See, what I am trying to do is generate a static file on my server's file system and store its generation time in django.conf.settings. I am more than aware that all settings are lost when the fcgi server is restarted, this is ok. But, the behavior (and problem) I'm seeing is that the setting is being reset every so often. I cannot determine why it is being reset, it seems fairly random. Does anyone out there know if Django resets its settings every so often? or should I be looking for a bug in my logic? How about another way to achieve what I want? Could this be related to running the fcgi server in threaded mode? I may just end up writing the timestamp to the filesystem, we will see... PS: My code works as expected when I use Django's local lighttp server. PPS: Django's Caching Framework would probably have been a smart way to get what I want, but at this point I won't be able to use it :(
does django-nonrel is compatible with django 1.7
26,293,980
0
1
250
1
django,python-2.7,django-nonrel
Django-nonrel isn't "compatible" with anything. It is actually a fork of Django, currently based on the 1.5 release.
0
0
0
0
2014-10-10T06:49:00.000
1
0
false
26,293,481
1
0
1
1
I am using Django 1.7 and I want to use MongoDB, So for that I try to install django-nonrel. Please let me know django-nonrel is compatible with Django 1.7?
Paypal loses session data
27,332,269
1
0
151
0
django,python-2.7,django-paypal,paypal,django-oscar
The problem was i was using get method for redirecting to paypal,later i changed that to post and it worked for me.I have used oscar for this, in that checkout view i wrote redirection in post function,which made it work
0
0
0
0
2014-10-10T09:16:00.000
1
1.2
true
26,295,908
0
0
1
1
Am using django oscar paypal and django oscar-0.7, when i submit for payment page get redirected to paypal site. After continuing that step and redirecting back to my site, it shows basket is empty and all paypal session is lost. Am stuck up here. Please help me in this?
odoo mod_wsgi schedulers not working
26,330,930
0
0
246
0
python,apache,deployment,openerp,mod-wsgi
The schedulers don't work when running through wsgi because your Odoo instances are just workers. AFAIK you just run a standalone instance on a 127.0.0.1 port and it runs your scheduled tasks.
0
1
0
0
2014-10-10T15:18:00.000
1
0
false
26,302,718
0
0
1
1
When I deploy openerp/odoo using mod_wsgi, I found my schedulers stop working, can any one help how can I get my cron/schedulers working. If I deploy it using mod_proxy it will solve the issue but I want to deploy using mod_wsgi.
Django apps structure
26,305,048
0
1
73
0
python,django
When you say "procedures" i guess you're talking about pages (or views in Django). So I would implement a single "app" to do that. Remember a project is composed of apps. When you create a project a main app (with the same name of the project) is created. This is a good place to code the procedures you said. Think of apps as indepent sections of your project (site); maybe some forum, a blog, a custom administration panel, a game and stuff like that. Every one of them could be an independent app. A project is mostly intended as a single website, so there's no need to create another project on the example you mentioned.
0
0
0
0
2014-10-10T16:57:00.000
1
0
false
26,304,413
0
0
1
1
I'm learning Django but it's difficult to me to see how should I divide a project into apps? I've worked on some Java EE systems, almost for procedures for government and all that stuff but I just can't see how to create a Django project for this purposes? For example, if you should have to do a web app for making easier three process: Procedure to get the passport, procedure to get the driver license and procedure to get the social number. The 3 procedures have steps in common: Personal information, Contact Information, Health Information. Would you do a project for each procedure, an app for each procedure, an app for each step? I'm sorry if I'm posting this in the wrong Stack Exchange site. Thank you.
Best way to display real-time data from an SSH accesible file on webpage
26,307,516
1
1
856
0
php,python,wordpress,ssh,webpage
Have a program monitor the file, either locally or via SSH. Have that program push updates into your web backend, via HTTP API or such.
0
1
0
1
2014-10-10T19:58:00.000
2
0.099668
false
26,307,163
0
0
1
1
I have a temperature logger that measures the records temperature values at specified time intervals. Currently I push these to a google spreadsheet but would like to display the values automatically on a web-page. I have no experience with anything to do with web-pages, except setting up a few Wordpress sites but am reasonably comfortable with C++, Python, Matlab and Java. A complicating factor is that the machine is in a VPN, so that access it via SSH I need to join the VPN. I suspect the best way is to have a Python script that periodically send a up-to-date file to the web-server via ftp and then some script on the server that plots this. My initial though was to use Python via something like CGI to read the data and create a plot on the server. However, I have no idea what the best approach on the server side would be. Is it worth to learn some PHP? Or should I write a Java Applet? Or CGI is the way to go? Thank you for your help
Android - ADB/MonkeyRunner Setting API Levels
26,311,559
0
0
225
0
android,python,adb,monkeyrunner
You are trying to install an APK which is intended for a higher version onto API level 8 and thus the package manager refuses to install it. It has nothing to do with adb or monkeyrunner.
0
0
0
0
2014-10-11T04:20:00.000
1
1.2
true
26,311,022
0
0
1
1
I've downloaded an APK onto a Velocity Cruz Tablet running Android 2.2.1 (API Level 8), and I'm trying to install it via whatever I can manage to make work. I already had ADT on my computer (Windows 8.1 if this helps) for API Level 19 for use with my phone. So I used the SDK Manager to get API Level 8. I can't for the life of me figure out how to make adb or monkeyrunner target API Level 8. I've got the paths right but the problem I'm having is making it target the proper API Level. I've gone through the adb commands, pm commands and MonkeyRunner API Documentation, but I don't see anything helpful. I've decided to come here to see if anyone knows what to do. Thanks.
unable to save a .py file in sublime using django
26,313,332
1
0
619
0
django,python-2.7,sublimetext3
please check if you are permitted to write on that directory.
0
0
0
0
2014-10-11T05:42:00.000
1
0.197375
false
26,311,527
0
0
1
1
I am a total noob in python.I am trying to save a .py file which I wrote it using the sublime3 editor but it doesn't allow me to save it.It says the file is read only.I am using django framework .Any suggestions ?
How to manually copy folder to /app/.heroku/python/lib/python2.7/site-packages/?
26,317,020
0
1
248
0
python,heroku,importerror,psycopg2
You could keep the psycopg2 directory in the same directory of apps, but that's actually a hack and you should try fix on installing psycopg2 on Heroku.
0
0
0
1
2014-10-11T15:34:00.000
1
0
false
26,316,273
0
0
1
1
I have deployed my local python web service project to Heroku. I have all my dependencies in requirement.txt file. But, one module psycopg2 is not getting installed properly and I am getting installation error. So, I removed it from requirement.txt and thought I will push everything to heroku first, and then I will manually copy the psycopg2 module folder in /app/.heroku/python/lib/python2.7/site-packages folder. But I don't know how to access this folder! Can you please help?
Open a URL with default broswer?
26,428,421
1
3
1,277
0
android,segmentation-fault,android-browser,qpython,pyjnius
Apparently, this happens just in console mode, so in other QPython mods it works fine.
1
0
0
0
2014-10-11T19:16:00.000
2
1.2
true
26,318,326
0
0
1
1
I'm new developer in QPython (experienced with python), I want to open an url with user's default browser. I tried AndroidBrowser().open("...") but, to my surprise, I got Segmentation Fault! So I said OK, let's try to open it manually as activity, then I tried to import jnius and got Segmentation Fault as well. Any suggestion how to fix it or other ways to open the browser?
Gunicorn workers restart by connection reset
26,890,297
0
2
882
0
python,deployment,pyramid,wsgi,gunicorn
I mis-diagnosed the problem. It seems that both Firefox and Chrome perform certain optimizations when loading the same page address multiple times. I thought the server was becoming irresponsive, but in fact there were no requests generated to serve.
0
0
0
0
2014-10-12T00:30:00.000
1
0
false
26,320,645
0
0
1
1
It seems to me that my gunicorn workers are restarted each time there is connection reset by a browser (e.g. by reloading a page while a request is still progress or as a result of connectivity problems). This doesn't seem to be a sensible behaviour. Effectively I can bring down all the workers just by refreshing a page in a browser a few times. Questions: What are the possible causes for a gunicorn worker restart? What would be the right way to debug this behaviour? I'm using Pyramid 1.4, Gunicorn (tried eventlet, gevent and sync workers - all demonstrate the same behaviour). The server runs behind nginx.
google app engine dev_appserver.py file not found
39,908,883
1
2
1,087
0
python,google-app-engine,python-2.7
On my PC it is found under this directory: C:\Users\Bob\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine I would assume that on Apple OS it will be similar based on where you decided to install the Cloud SDK.
0
1
0
0
2014-10-12T11:28:00.000
1
0.197375
false
26,324,636
0
0
1
1
i have searched through many python issues and none seem to help me with mine or i just don't understand it enough to resolve the issue. basically i am trying to learn python so in the process on my mac i have installed serveral versions and had many version issues which so far i have been able to resolve by looking up ways to resolve it. however i am now at a part in head first python that needs to install google app engine the book is a good bit out of date so i installed the latest app engine and made the symbolic links but when i run the application the browser is greyed out. i have seen many references to dev_appserver.py in my long search to resolve this. i cannot my this file anywhere on my machine so i presume i have an issue with my install of python2.7 i have re-installed and then uninstalled and re-installed python 2.7 over and over but still cannot find the dev_appserver.py file . does anyone have a concrete way to ensure dev_appserver.py will be installed. thanks in advance from a seriously frustrated python beginner.
Module rest_framework not found on pythonanywhere.com app
26,351,856
3
2
1,418
0
python,django,django-rest-framework,pythonanywhere
It turns out that it was a python version issue. It was installing rest_framework under python 2.7 and my application was using python 3.3. To install it for python 3.3 I ran the following. pip3.3 install djangorestframework
0
0
0
0
2014-10-14T01:55:00.000
1
1.2
true
26,351,509
0
0
1
1
I am having trouble deploying my app on pythonanywhere.com. I have followed instructions to get teh django rest frameowrk package installed via pip by running the following pip install --user djangorestframework When I go into my console and run pip freeze it outputs djangorestframework==2.4.3 as one of the installed packages. However, if I got to my python console and try import rest_framework or try to add rest_framework as an installed app in my django settings, I get this error. ImportError: No module named 'rest_framework' How do I get it to be recognized by my console and my application?
How to store data crawled in scrapy in specfic order?
26,378,448
0
0
262
0
python-2.7,scrapy,web-crawler
For this we have to make a list in fields_to_export in the BaseItemExporter class field_iter = ['Offer', 'SKU', 'VendorCode'] like this and then have to pass this list in the field
0
0
0
0
2014-10-14T07:35:00.000
2
0
false
26,355,152
0
0
1
1
I have to crawl data from a web page in a specfic order as liked i declared fields in my item class and then have to put them in csv file.problem now occuring is there its stores data not in specfic order as like its scrapping data of any field and putting in csv file but i want it should store data as i declared in my item class. I am newbie in python. can you tell me how to do this For ex: my item class is class DmozItem(Item): title = Field() link = Field() desc = Field() Now when its storing data in csv file its storing first desc ,link and then title "desc": [], "link": ["/Computers/Programming/"], "title": ["Programming"]}
Make an object exists in all templates
26,358,812
1
0
58
0
python,django,templates,variables
You can add variables to context
0
0
0
0
2014-10-14T10:26:00.000
2
0.099668
false
26,358,511
0
0
1
1
I have a django and I wrote some views. I know how to pass my variables to template, but I also has some external modules with their own views, which I wont modify. Please help me understand how can I get one of my object "Menu.objects.all()" exist in all templates? So for example a I have django-registration and i want to have all my menu items appear at top when someone visits not my app url. I mean it will be registration app url, which returns templateresponse (and here I dont have my variable).
How to search for JavaScript variables in a file, using Python?
26,358,654
-3
1
1,278
0
javascript,python
If you use an IDE such as phpstorm, it can easily find variables for you. I don't see the use in programming something in Python to do this.
0
0
0
0
2014-10-14T10:28:00.000
2
-0.291313
false
26,358,543
1
0
1
1
I have directory with many JaveScript files. Here I want to scan each file and want to replace each JavaScript variable with string like 'str1', 'str2', 'str3', ..., 'strn' and so on. My question is: how to identify a JavaScript variable? Doubts: If I say keyword after var is a variable, however there is no compulsion of var while declaring variable If I say keyword before = is a variable, however file also contains HTML code, so inside HTML tag there is = sign between attribute and its value. So how can I identify the variables I have to replace?
Can I configure Django runserver to reload when static or non-python files are changed?
49,406,541
1
5
3,709
0
python,django
There is no need to reload server, but sometimes there is need to copy static files to be visible for the server. Instead running collectstatic while developing, which copy recently edited static files (like javascript) from one directory to the directory, used by server. here is a trick: link source directory to behalf of the target (will "override" target directory) or run in loop: python manage.py collectstatic --noinput then your server will see all changes in files.
0
0
0
0
2014-10-15T16:29:00.000
5
0.039979
false
26,387,529
0
0
1
4
By default, Django's runserver command auto reloads the server when python or template files are changed. Is it possible to configure Django to extend its file monitoring for this purpose to other directories or sets of files, such as JavaScript or CSS files being served statically (during development)? This would be useful in this scenario: the Django app reads a set of static text files on startup and I would like the server to re-read them when they change, without having to add this specific feature - simply restarting would be fine. Do I need to start meddling with (or extending) django/utils/autoreload.py ?
Can I configure Django runserver to reload when static or non-python files are changed?
26,405,259
1
5
3,709
0
python,django
The static files are automatically served from disk, so there is no need to reload the dev server. But your browser has it's own cache, and is keeping some of your static files in it... To reload it use this shortcut : Ctrl + Shift + r OR Ctrl + f5 If your on mac use CMD button instead of ctrl
0
0
0
0
2014-10-15T16:29:00.000
5
0.039979
false
26,387,529
0
0
1
4
By default, Django's runserver command auto reloads the server when python or template files are changed. Is it possible to configure Django to extend its file monitoring for this purpose to other directories or sets of files, such as JavaScript or CSS files being served statically (during development)? This would be useful in this scenario: the Django app reads a set of static text files on startup and I would like the server to re-read them when they change, without having to add this specific feature - simply restarting would be fine. Do I need to start meddling with (or extending) django/utils/autoreload.py ?
Can I configure Django runserver to reload when static or non-python files are changed?
26,388,429
0
5
3,709
0
python,django
As the comments on your question say, Django always pulls the file from the filesystem on every request, so they are not cached. However, there is a check (indjango.views.static) for the mtime of the file if the browser sends an If-Modified-Since header which is why you may be seeing 304 Not Modified. Regardless, would simply disabling browser caching meet your needs?
0
0
0
0
2014-10-15T16:29:00.000
5
0
false
26,387,529
0
0
1
4
By default, Django's runserver command auto reloads the server when python or template files are changed. Is it possible to configure Django to extend its file monitoring for this purpose to other directories or sets of files, such as JavaScript or CSS files being served statically (during development)? This would be useful in this scenario: the Django app reads a set of static text files on startup and I would like the server to re-read them when they change, without having to add this specific feature - simply restarting would be fine. Do I need to start meddling with (or extending) django/utils/autoreload.py ?
Can I configure Django runserver to reload when static or non-python files are changed?
71,053,904
0
5
3,709
0
python,django
The answer to this is YES, all you need to do is touch your settings file which will trigger a runserver reload. If all you need to do is source new static files, you don't need this, but if you need to trigger a reload for another reason, it is possible with a simple touch.
0
0
0
0
2014-10-15T16:29:00.000
5
0
false
26,387,529
0
0
1
4
By default, Django's runserver command auto reloads the server when python or template files are changed. Is it possible to configure Django to extend its file monitoring for this purpose to other directories or sets of files, such as JavaScript or CSS files being served statically (during development)? This would be useful in this scenario: the Django app reads a set of static text files on startup and I would like the server to re-read them when they change, without having to add this specific feature - simply restarting would be fine. Do I need to start meddling with (or extending) django/utils/autoreload.py ?
Pyramid app with handlebar.js: I don't need a template for this view; how to disable?
26,392,168
1
0
68
0
javascript,python,templates,pyramid
This was a red herring; the URL was wrong but the log file mentioned a missing template so I was focused in the wrong direction. I had to get a custom redirection piece of code from one of the developers on this project and I have it working now.
0
0
0
0
2014-10-15T20:09:00.000
1
0.197375
false
26,391,208
0
0
1
1
I'm adding a page to a complex Pyramid-based app that uses Handlebar templates. I need a file download URL that doesn't need a template, but the system is giving me a 404 code for missing template anyway. How do I tell a view at configuration time "do not use a handlebar template with this one?"
The time to queue tasks in celery bottlenecks my application - how to parallelize .delay()?
26,732,448
0
0
349
0
python,parallel-processing,rabbitmq,celery,django-celery
If queuing up your tasks takes longer than the task, how about you increase the scope of the tasks so they operate on N files at a time. So instead of queuing up 1000 tasks for 1000 files. You queue up 10 tasks that operate on 100 files at a time. Make your task take a list of files, rather than a file for input. Then when you loop through your list of files you can loop 100 at time.
0
1
0
0
2014-10-15T23:00:00.000
1
0
false
26,393,540
0
0
1
1
I'm having a major problem in my celery + rabbitmq app where queuing up my jobs is taking longer than the time for my workers to perform jobs. No matter how many machines I spin up, my queuing time will always overtake my task time. This is because I have one celery_client script on one machine doing all the queuing (calling task.delay()) sequentially. I am iterating through a list of files stored in S3. How can I parallelize the queuing process? I imagine this is a widespread basic problem, yet I cannot find a solution. EDIT: to clarify, I am calling task.delay() inside a for loop that iterates through a list of S3 files (of which there are a huge amount of small files). I need to get the result back to me so I can return it to the client, so for this reason I iterate through a list of results after the above to see if the result is completed -- if it is, I append it to a result file. Some solutions I can think of immediately is some kind of multi threaded support in my for loop, but I am not sure whether .delay() would work with this. Is there no built in celery support for this problem? EDIT2 More details: I am using one queue in my celeryconfig -- my tasks are all the same. EDIT3: I came across "chunking", where you can group a lot of small tasks into one big one. Not sure if this can help out my problem, as although I can transform a large number of small tasks into a small number of big ones, my for loop is still sequential. I could not find much information in the docs.
Generate long-lived access token from short-lived one?
26,395,567
2
1
236
0
python,google-app-engine,google-oauth
there is no reason why generating more access tokens from refresh tokens would cause an error. existing non-expired access tokens are not invalidated when a new one is produced from the refresh token. check your code for errors there. also there is no way to generate a long lived access token. what you ask is how oauth1/clientlogin used to work (they expired after 2 weeks instead of 1 hour). in oauth2 there is no such thing as a long lived access token.
0
0
0
0
2014-10-16T01:20:00.000
1
1.2
true
26,394,754
0
0
1
1
Our app uses the usual short-lived access + refresh tokens to do a bunch of background services for users. This means that every now and then the services need to refresh the tokens. We've run into an issue where 2 services try to refresh a token at the same time, thus resulting in an invalid token. Is there a better way to generate a usable access token that doesn't require a refresh every hour?
pdfminer3k has no method named create_pages in PDFPage
43,130,993
3
6
8,846
0
python,pdfminer
Perhaps,you could use pdfminer.six. It's description: fork of PDFMiner using six for Python 2+3 compatibility After installing it using pip: pip install pdfminer.six The usage of it is just like pdfminer, at least in my code. Hope this could save your day :)
0
0
0
0
2014-10-16T20:21:00.000
2
0.291313
false
26,413,216
0
0
1
1
Since I want to move from python 2 to 3, I tried to work with pdfmine.3kr in python 3.4. It seems like they have edited everything. Their change logs do not reflect the changes they have done but I had no success in parsing pdf with pdfminer3k. For example: They have moved PDFDocument into pdfparser (sorry, if I spell incorrectly). PDFPage used to have create_pages method which is gone now. All I can see inside PDFPage are internal methods. Does anybody has a working example of pdfminer3k? It seems like there is no new documentation to reflect any of the changes.
Openerp full access for a group
26,478,950
2
0
59
0
python,openerp
You can set access rights from Menu : Settings --> Groups --> Access Rights tab
0
0
0
0
2014-10-17T12:33:00.000
2
0.197375
false
26,425,120
0
0
1
2
How to set full access to a group in my custom module in OpenErp? Now some users doesn't have access everywhere because they are filtered by domain_filters.
Openerp full access for a group
26,483,435
2
0
59
0
python,openerp
You can create an ir.model.access.csv file, and give access rights to all the objects you want for the particular user group.
0
0
0
0
2014-10-17T12:33:00.000
2
1.2
true
26,425,120
0
0
1
2
How to set full access to a group in my custom module in OpenErp? Now some users doesn't have access everywhere because they are filtered by domain_filters.
How can I find the current apps name from python on heroku?
26,463,868
1
0
82
0
python,heroku
Via Heroku support: Finding the app's name is not something currently possible to do, sorry. The only thing you can potentially do is to analyse the hostname requests are coming from and deduce the app's name with it.
0
0
0
0
2014-10-17T14:02:00.000
1
1.2
true
26,426,780
0
0
1
1
How can I find the current apps name from python on heroku? I want to know, because I'm using the heroku button to start and instance automatically. Can it be made part of os.environ somehow?
heroku - get app IP to whitelist queries
26,444,744
0
0
388
0
python,mysql,heroku
Heroku dynos are ephemeral. Even if you manually figure out your dyno's IP, it's going to change frequently. IP whitelisting isn't a viable scheme for securing connections between Heroku apps and other services. You should use TLS.
0
0
0
0
2014-10-18T01:08:00.000
2
0
false
26,435,360
0
0
1
1
I've pushed my first app to heroku and everything looks good except for an issue w/ MySQL. I'm pushing/pulling a remote server that asks me to whitelist specific ip addresses. I can't find the ip address for the heroku app I've deployed so all of the queries return errors. Any thoughts on the best way to get that? Thanks
Creating login for a websocket application?
26,441,656
0
1
83
0
javascript,python,websocket
Cookie is available with websocket. Just login and store a session/cookie for the user as normal. The you will know who it is. Or, just send the cookie as the first message after connecting.
0
0
1
0
2014-10-18T09:04:00.000
1
1.2
true
26,438,022
0
0
1
1
I've created a websocket avatar chat application where a user is given an avatar and they can move around with this avatar and send messages. I want to design a login which connects to my database (already has several accounts stored). When a user has logged in with the correct details, I'd like for their username to be shown on a chatlog i.e. "Damien has logged in". Of course there'd be several more features I'd be able to finally work on when I implement the login with the application but I'm not sure how I can. I'm presuming it will involve adding perhaps a user array list in the room? The websocket server is created in python, client in html5 and javascript. Any suggestions?
Where to store software generated user-specific image files in Python Django?
26,440,891
1
0
50
0
python,django,django-templates,project-structure,filestructure
There are a few options, and the answer depends on the specifics of your software and hardware. Are the images small and can they be generated quickly? Generate the images on-the-fly from a Django view. Do not store them anywhere. Have a url such as /user/some-important-widget-image/5/ which outputs a PNG of the some-important-widget image for user with the ID 5. Are the files big, take a long time to generate, or generating them on the fly will not work because the server cannot handle it? Store them in the media directory. Have a cron job which every day, week, or month deletes images which were generated more than X hours ago.
0
0
0
0
2014-10-18T13:10:00.000
1
0.197375
false
26,440,093
0
0
1
1
I want to view html page with images dynamically generated on user's request by Python script in Django. I do not need to store them permanently, only to generate response html page from template. Where should I store these images (or should I)? When should I delete the images if I store them somewhere on server?
Do rest servers need to be hosted on a website or CMS?
26,446,258
0
1
141
0
python,rest,content-management-system,hosting
The beauty of REST is precisely that it doesn't matter where your API is, as long as its accessible from your Drupal server, or from the client if you have a javascript API client. If it's a simple application and you have admin access to your Drupal server, there's nothing preventing you from hosting the Python webservice side-by-side. They may even share the same HTTP Server, like Apache or Nginx, although depending on your demands on each one it might be better to keep them separate. If you're new to Python, the Flask framework is a decent option to write a simple REST-like API interfacing with a Python module.
0
0
1
0
2014-10-18T21:09:00.000
1
1.2
true
26,444,590
0
0
1
1
I need to create a REST server of a python module/API of a BCI, so that the application can be accessed on my Drupal website. Will I need to create and host the REST server on a python-based website or CMS, so that it can be accessed by my Drupal website, or is the api and rest server uploaded and hosted directly on my web hosting server? If so, what is the simplest python CMS that for creating a REST server for a python module/API already available?
Django haystack. How to alter names of check boxes?
26,449,620
0
0
36
0
python,django,django-haystack,whoosh
is it not the label=_("Field_name") parameter in the checkbox field? if its about the verbose name there is also verbose_name_plural which can be set up in models
0
0
0
0
2014-10-19T08:25:00.000
1
0
false
26,448,733
0
0
1
1
I installed django haystack using whoosh. Everything works great, but I want to alter the names displayed next to the check boxes. I know they are generated using the verbose name set up on the models but I still have an issue with the 's' being added at the end of the names. I know there are custom forms and custom views but I am new to programming and some of the concepts do not make sense. I have also tried to search for any ideas but have had no luck. Any suggestions/advice? Thanks in advance! :)
Django Rest Framework, can I use ViewSet to generate a json from django view function?
32,542,169
3
6
6,147
0
python,django,rest,django-rest-framework
Yes, you can call YourViewSet.as_view()(self.request) in your Django view. Make sure you call the ViewSet like below: YourViewSet.as_view({'get': 'list'})(self.request) Else it will raise an exception The actions argument must be provided when calling .as_view() on a ViewSet. For example .as_view({'get': 'list'})
0
0
0
0
2014-10-20T07:08:00.000
1
0.53705
false
26,460,151
0
0
1
1
I know I can use drf serializer from django views, but queryset, pagination setting is all duplicated in drf viewset and django view. Can I reuse viewset to generate json data and include it in regular django response? Update: ie, Can I call ViewSet.as_view()(self.request) from django view? it's not documented way, so I'm wondering the downsides of this approach .. and if it's doable..
web.py how to get message from request when the contentType is 'text/xml'
26,498,875
1
0
86
0
python,web.py
Use web.data().
0
0
1
0
2014-10-21T06:04:00.000
1
0.197375
false
26,479,903
0
0
1
1
My situation is : A server send a request to me, the request's contentType is 'text/xml', and the request content is an xml. First I need to get the request content. But when I use 'web.input()' in 'POST' function, I couldn't get any message, the result just is ''. I know web.py can get form data from a request, so how I can get message from request when the contentType is 'text/xml' in POST function. Thanks!
How to avoid duplicating context-setting-up procedure when using base template?
26,513,516
0
2
81
0
python,flask,jinja2
One way I can think of is to use a decorator that provides extra context variables to each view's result.
0
0
0
0
2014-10-21T12:31:00.000
3
0
false
26,486,808
0
0
1
1
When using jinja2, base "skeleton" template are often extended by many other templates. One of my base templates require certain variables in the context, and everywhere I use this base template I have to duplicate the setting up procedure. For example, I may need to read some category names from DB and render them as a list in the header, now I have to write this query everywhere I use the base template. What are some good way to avoid duplicating these kind of code when using jinja2?
Run specific django manage.py commands at intervals
26,487,761
1
0
368
0
python,django,django-chronograph
I would suggest you to configure cron to run your command at specific times/intervals.
0
1
0
0
2014-10-21T13:14:00.000
3
0.066568
false
26,487,648
0
0
1
2
I need to run a specific manage.py commands on an EC2 instance every X minutes. For example: python manage.py some_command. I have looked up django-chronograph. Following the instructions, I've added chronograph to my settings.py but on runserver it keeps telling me No module named chronograph. Is there something I'm missing to get this running? And after running how do I get manage.py commands to run using chronograph? Edit: It's installed in the EC2 instance's virtualenv.
Run specific django manage.py commands at intervals
26,488,221
0
0
368
0
python,django,django-chronograph
First, install it by running pip install django-chronograph.
0
1
0
0
2014-10-21T13:14:00.000
3
0
false
26,487,648
0
0
1
2
I need to run a specific manage.py commands on an EC2 instance every X minutes. For example: python manage.py some_command. I have looked up django-chronograph. Following the instructions, I've added chronograph to my settings.py but on runserver it keeps telling me No module named chronograph. Is there something I'm missing to get this running? And after running how do I get manage.py commands to run using chronograph? Edit: It's installed in the EC2 instance's virtualenv.
python '14 fast SOAP Client
26,581,414
0
1
342
0
python,soap-client,suds
While I couldn't find an alternate lib, I was able to run suds over multiprocessing using pathos.multiprocessing package.
0
0
0
1
2014-10-21T13:20:00.000
1
0
false
26,487,774
0
0
1
1
I am using suds-jurko==0.6, but its very slow when i try to connect to remote SOAP Server with caching and local WSDL. Can anyone suggest faster, more active/recent SOAP client for Python?
How to tell if my AWS account "owns" a given IP address in Python boto
26,495,168
0
1
1,555
0
python,amazon-web-services,amazon-ec2,boto
Here's the method I have come up with: To look up all IPs to see if they are EIPs associated with our AWS account Get a list of all our EIPs Get a list of all instances Build list of all public IPs of instances Merge lists/use same list Check desired IPs against this list. Comments welcome.
0
0
1
1
2014-10-21T18:00:00.000
2
0
false
26,493,207
0
0
1
1
So I have a list of public IP addresses and I'd like to see if they are a public IP that is associated with our account. I know that I can simply paste each IP into the search box in the AWS EC2 console. However I would like to automate this process via a Python program. I'm told anything you can do in the console, you can do via CLI/program, but which function do I use to simply either return a result or not, based on whether it's a public IP that's associated with our account? I understand I may have to do two searches, one of instances (which would cover non-EIP public IPs) and one of EIPs (which would cover disassociated EIPs that we still have). But how?
Ghost.py links through javascript
26,505,780
1
0
565
0
javascript,python,ghost.py
I solved my problem. There is an optional parameter to the Ghost class' click() method called expect_loading and when set to true it sets an internal boolean self.loaded = False and then calls wait_for_page_loaded() which then works, I guess because of the loaded boolean.
0
0
1
0
2014-10-21T18:10:00.000
1
1.2
true
26,493,370
0
0
1
1
I'm having an issue with Ghost.py. The site I am trying to crawl has links for a paginated list that work with javascript, rather than direct hrefs. When I click the links, I can't really wait for selectors because the selectors are the same on each page, so ghost doesn't wait since the selector is already present. I can't assume I know what text will be on the next page, so waiting for text will not work. And waiting for page loaded won't work either. It's almost as though the javascript is not being executed. Ghost.py seems to have minimal documentation (if you can call the examples on the website documentation) so it is really difficult to work out what I can do, and what tools are available to me. Can anybody with more experience help me out?
Why does Django make migrations for help_text and verbose_name changes?
57,603,582
1
54
7,359
0
python,django,database-migration,django-1.7,django-1.9
From Django 2.X, using ugettext_lazy instead of ugettext or gettext fixes it.
0
0
0
0
2014-10-22T09:01:00.000
8
0.024995
false
26,503,826
0
0
1
1
When I change help_text or verbose_name for any of my model fields and run python manage.py makemigrations, it detects these changes and creates a new migration, say, 0002_xxxx.py. I am using PostgreSQL and I think these changes are irrelevant to my database (I wonder if a DBMS for which these changes are relevant exists at all). Why does Django generate migrations for such changes? Is there an option to ignore them? Can I apply the changes from 0002_xxxx.py to the previous migration (0001_initial.py) manually and safely delete 0002_xxxx.py? Is there a way to update previous migration automatically?
Celery: Abort or revoke all tasks in a chord
26,513,120
0
4
3,818
0
python,task,celery,chord
Instead of chording the tasks themselves you may want to consider having the chords tasks that watch the A tasks. What I mean by this is the chord would contain tasks that check the running tasks(A) every so often to see if they are done or revoked. When all of those return successfully the chord with then chain into task B
0
1
0
0
2014-10-22T16:24:00.000
2
0
false
26,512,324
0
0
1
1
I use the following setup with a Redis broker and backend: chord([A, A, A, ...])(B) Task A does some checks. It uses AbortableTask as a base and regularly checks the task.is_aborted() flag. Task B notifies the user about the result of the calculation The user has the possibility to abort the A tasks. Unfortunately, when calling AbortableAsyncResult(task_a_id).abort() on all the task A instances, only the active ones are being aborted. The status for tasks that have not been received yet by a worker are changed to ABORTED, but they're still processed and the is_aborted() flag returns False. I could of course revoke() the pending tasks instead of abort()-ing them, but the problem is that in that case the chord body (task B) is not executed anymore. How can all pending and running task A instances be stopped, while still ensuring that task B runs?
django-registration POST 405
26,518,127
0
0
51
0
python,django,django-registration
I changed django-registration's template views to specific views and it works now.
0
0
0
0
2014-10-22T21:33:00.000
1
1.2
true
26,517,504
0
0
1
1
I have moved login form into my base.html and I added this line to my template tag to make the login form work.: login(request, template_name='base.html') It works in my links and the auth links but it doesn't work with django-registration's links such as /accounts/registration/complete/. I want to make them work but I couldn't figure out why it's not working. How can I fix it? Thanks.
User Registration and Authentication to a Database using Javascript
26,518,519
0
0
959
1
javascript,python,ruby-on-rails,angularjs,node.js
Welcome to the world of development. In general, javascript is only used to give more resources to the user's navigation on the site (ex: visual effects). As you're starting out, I advise you to start studying the part of the server-side login. For security purposes who confirms whether the user is logged in or not is always the server. Some developers prefer PHP, other developers love Ruby on Rails. Maybe your best friend prefer Python... It is your choice, they both are easy.
0
0
0
0
2014-10-22T22:41:00.000
3
0
false
26,518,355
0
0
1
1
I'm new to Web Dev and I came across a problem. I was wondering if there's a Javascript Framework that will allow me to register and authenticate users to a database like when using PHP and MySql. Also, when the user is granted access to the site, such user will be required to upload files that will be written to the local filesystem of that server. Can this be done with Javascript or some sort of Javascript Framework, or is it better just for me to learn PHP and do it in a normal LAMP stack? Or perhaps Ruby on Rails? I have been searching online but the majority of results are leaning towards PHP & MySql. Thanks a lot!
Blank page in OpenERP after module install
37,538,805
0
2
1,658
0
python,openerp,odoo
I had same experience like yours. I think most of the time this happened because of a permission issue for certain files or database issue. You cannot drop database on a production environment right?. So best way to solve it is removed last updated module source from addon folder and restart the odoo service. Then update your addon source from working copy and install them.
0
0
0
0
2014-10-23T13:07:00.000
2
0
false
26,528,833
0
0
1
2
Maybe someone could help me. I've installed Odoo (OpenERP) on localhost and I've installed many basic modules (15). I have a problem, after install Expense Tracker module the web client displays a blank page, in any section. I can't see also the Settings page, just the menu bar at the top. If I install just the Expense Tracker, it works. So it isn't a module problem. Thank you! :)
Blank page in OpenERP after module install
41,838,775
0
2
1,658
0
python,openerp,odoo
I is likely that you installed a corrupt module. Refer to the addons and delete a module that you installed last. This should sort out your problem as it did on my end
0
0
0
0
2014-10-23T13:07:00.000
2
0
false
26,528,833
0
0
1
2
Maybe someone could help me. I've installed Odoo (OpenERP) on localhost and I've installed many basic modules (15). I have a problem, after install Expense Tracker module the web client displays a blank page, in any section. I can't see also the Settings page, just the menu bar at the top. If I install just the Expense Tracker, it works. So it isn't a module problem. Thank you! :)
PyUSB read multiple frames from bulk transfer with unknown length
26,553,765
1
0
2,500
0
python,python-3.x,usb,pyusb
Solved my own issue. After running my code on a full linux machine, capturing the data and comparing it to the wireshark trace I took on the windows application, I realized the length of the read was not the issue. The results were very similar and the windows app was actually requesting 4096 bytes back instead of 2 or 7 and the device was just giving back whatever it had. The problem actually had to do with my Tx message not being in the correct format before it was sent out.
0
1
0
1
2014-10-23T21:45:00.000
1
1.2
true
26,538,004
0
0
1
1
So I'm relatively new to USB and PyUSB. I am trying to communicate with a bluetooth device using PyUSB. To initialize it, I need to send a command and read back some data from the device. I do this using dev.write(0x02, msg) and ret = dev.read(0x81, 0x07). I know the command structure and the format of a successful response. The response should have 7 bytes, but I only get back 2. There is a reference program for this device that runs on windows only. I have run this and used USBPcap/wireshark to monitor the traffic. From this I can see that after my command is sent, the device responds several times with a 2 byte response, and then eventually with the full 7 byte response. I'm doing the python work on a Raspberry Pi, so I can't monitor the traffic as easily. I believe the issue is due to the read expecting 7 bytes and then returning the result after the default timeout is reached, without receiving the follow up responses. I can set the bytes to 2 and do multiple readings, but I have no way of knowing if the message had more bytes that I am missing. So, what I'm looking for is a way to check the length of the message in the buffer before requesting the read so I can specify the size. Also, is there a buffer or anything to clear to make sure I am reading next message coming through. It seems that no matter how many times I run the read command I get the same response back.
In Odoo / OpenERP 8, How to visible button Attachment for a specific group on a specific model form?
26,581,186
0
0
1,038
0
python,openerp,odoo
You can add groups attribute to that button in .xml file. like Eg: groups="group_eg"
0
0
0
0
2014-10-24T04:01:00.000
1
0
false
26,541,264
0
0
1
1
In Odoo / OpenERP 8, How do I visible button Attachment for a specific group on a specific model form? Thanks very much!
Interrelated resources
27,251,344
0
0
88
0
python-2.7,simpy,traffic-simulation
I guess you can just request the other resources (B and C; maybe using preemption) once you get resource A and release all three resources once you are done with A.
0
0
0
0
2014-10-24T17:45:00.000
1
0
false
26,553,392
0
0
1
1
I am modelling a train station(using simpy, with python 2.7) where there are some incoming routes, some outgoing routes and some platforms. Now, when one of these resources is occupied, I can't assign a train to certain other resources. Now when a train engages a route - i.e. traverses it - some other routes in the stations area become unusable for some time. If I were to model a route as a resource, then a request yielded at that resource will affect/engage other resources as well. Is there some way of modelling resources, such that engagement of one resource_A puts resource_B, resource_C out of action for some predetermined amount of time? Aseem Awad
Make Tornado able to handle new requests while waiting response from RPC over RabbitMQ
27,069,239
0
0
199
0
python,asynchronous,rabbitmq,tornado,rpc
Use nginx with embedded perl.. It works like superman.. We are using this for our analytics tool.
0
1
0
0
2014-10-24T19:22:00.000
1
0
false
26,554,857
0
0
1
1
I have web-server listening clients and when someone hit handler server send an RPC message to RabbitMQ and waiting for response while keeping connection. When response from RMQ came server pass it to the client as response to request. All async examples in Tornado docs works with their own http.fetch_async() or something like that methods, and I understand that I have to wait/read for RMQ asynchronously... But how? And even worse - sometimes I have to send several messages at one moment (I create pool of threads and each thread send one message). Right now I cannot rebuild architecture to get rid of waiting to send an answer from RMQ, so I have web-server blocked. Yet we have no a lot of requests and RMQ response quickly enough but sometimes it can make server waiting up to a minute. So now we just using Gunicorn with A LOT of workers and BIG SERVERS but I feel it should be a better solution and investigate different options. Python 3.4, so we cannot use pika RMQ adapter and work with py-amqp from Celery.
What is the simplest way to create a NON-REST API in Django?
26,557,044
1
0
914
0
python,json,django,api,rest
I'm answering myself to the question: I just found out that the creator of Tastypie made a second Python API framework named Restless. Inspite of the name, it's still a Restfull framework, but the philosophy is very different from the former framework. In building Tastypie, I tried to create something extremely complete & comprehensive. The result was writing a lot of hook methods (for easy extensibility) & a lot of (perceived) bloat, as I tried to accommodate for everything people might want/need in a flexible/overridable manner. But in reality, all I really ever personally want are the RESTful verbs, JSON serialization & the ability of override behavior. This framework lets you hardcode the behaviour of each REST methods (thank you!!!!). The only thing now is to try to bypass the "REST behaviour" in an elegant way...
0
0
0
0
2014-10-24T20:55:00.000
2
1.2
true
26,556,120
0
0
1
1
There are debates about the pro's and con's of REST. I personnaly don't need it in my project, and this topic is not to debate about the fact I actally need it ^^ Just note that I used Tastypie in a "REST mode" and decided to switch to a non-REST mode because my app is not CRUD based at all. My API is an application API, not a user API. In my case, using REST force me to do dirty and foolish things. In my project, what I'd like to do can't be simpler: custom URL #1 executes some custom Django code custom URL #2 executes other custom Django code etc... That's it! The only things I need are: GET and POST requests. when a user calls a URL, I want to know who is this user (request.user) or not authenticated. I use classic HTTP authentication. return results as JSON sothat my clients understand it. The intrusive API stuff I don't need (but I am pretty forced to use it in a REST mode) are: Split logic by resources -> when a request need to deal with many models, splitted resources just drives me crazy to reach my goal. Authentication -> let me handle it myself with my Django code itself! My models actually DO know who can do what. So, How to create this non-REST api in a easy way? Which framework use? Thanks a lot.
Custom metric alarm function Amazon Cloudwatch
26,566,582
1
0
356
0
python,amazon-ec2,boto,amazon-cloudwatch
An alarm can only publish to an SNS topic but there are a number of ways to subscribe to that topic. You can get an SMS message, get email, or you can have your own program called via HTTP or HTTPS. You would have to write a small web application that listens for the SNS messages and then perform whatever action you want. Or you could subscribe an SQS queue to the SNS topic and then have your program poll the SQS queue waiting for messages.
0
0
0
0
2014-10-25T16:35:00.000
1
1.2
true
26,564,698
0
0
1
1
I am playing around with boto and Amazon EC2 instances. I am able to create an alarm on a metric for cpu utilisation that sends an email via an SNS Topic. However what I would like to do is call a function in my code when the alarm is triggered to launch a new instance. I don't see a way of placing anything besides an ARN string on an alarm action? Does anyone have any ideas? Thanks
How does a mobile phone know to use a different page?
26,598,616
3
0
115
0
python,html,css,django
You can have a single Django project for many screens by using i.e. front-end responsive framework such like Bootstrap or Fundation.
0
0
0
0
2014-10-27T23:28:00.000
5
0.119427
false
26,598,571
0
0
1
1
I'm making a website in Django, but i want to make two sites one for the phone and one for the computer. How do you instruct phones to load my phone friendly page instead of the normal website?
Django CAS and TGT(Ticket Granting Tickets) and service ticket validation
26,826,648
0
0
477
0
python,django,cas
Turns out django-cas handles TGT using django sessions. However, for validation of the service ticket, you have to manually make a validation request including the ST(service ticket) granted after login and the service being accessed.
0
0
0
0
2014-10-28T20:27:00.000
1
0
false
26,617,865
0
0
1
1
I'm using CAS to provide authentication for a number of secure services in my stack. The authentication front-end is implemented using Django 1.6 and the django-cas module. However, I'm reading around and I don't seem to get information on how django-cas handles Ticket Granting Tickets and also validation of service tickets. Does anyone know how the aspects mentioned are handled by django-cas?
How can I programmatically execute command line commands at a different leveled directory at a certain time interval?
26,708,022
1
0
190
0
python,command-line,cron,scrapy,twython
Use a cron job. This allows you to run a command line command at a time interval. You can combine commands with && and as a result can change directories with the normal bash command cd. So in this case you can call cd /directory/folder && scrapy crawl scrape_site && python twitter.py To run this every fifteen minutes make the cron job run like */15 * * * * So the full cron job would look like */15 * * * * cd /directory/folder && scrapy crawl scrape_site && python twitter.py
0
0
1
1
2014-10-29T02:00:00.000
1
1.2
true
26,621,636
0
0
1
1
I wrote a web scraper in Scrapy that I call with scrapy crawl scrape_site and a twitter bot in Twython that I call with python twitter.py. I have all the proper files in a directory called ScrapeSite. When I execute these two commands on the command line while in the directory ScrapeSite they work properly. However, I would like to move the folder to a server and have a job run the two commands every fifteen minutes. I've looked into doing a cron job to do so, but the cronjobs are located in a different parent directory, and I can only call scrapy in a directory with Scrapy files (e.g. ScrapeSite). Can I make a cron job to run a file in the ScrapeSite directory that in turn can call the two commands at the proper level? How can I programmatically execute command line commands at a different leveled directory at a certain time interval?
Accessing Python webserver remotely on Amazon EC2
26,626,875
6
4
1,858
0
python,amazon-web-services,amazon-ec2,webserver
you should open the 8080 port and ip limitation in security croups, such as: All TCP TCP 0 - 65535 0.0.0.0/0 the last item means this server will accept every request from any ip and port, you also
0
0
1
1
2014-10-29T08:37:00.000
2
1.2
true
26,625,845
0
0
1
1
I work on a project in which I need a python web server. This project is hosted on Amazon EC2 (ubuntu). I have made two unsuccessful attempts so far: run python -m SimpleHTTPServer 8080. It works if I launch a browser on the EC2 instance and head to localhost:8080 or <ec2-public-IP>:8080. However I can't access the server from a browser on a remote machine (using <ec2-public-IP>:8080). create a python class which allows me to specify both the IP address and port to serve files. Same problem as 1. There are several questions on SO concerning Python web server on EC2, but none seems to answer my question: what should I do in order to access the python web server remotely ? One more point: I don't want to use a Python web framework (Django or anything else): I'll use the web server to build a kind of REST API, not for serving HTML content.
Common celery workers for different clients having different DBs
26,644,301
1
0
412
1
python,django,celery,django-celery
Eventually you will have duplicates. Many people ignore this issue because it is a "low probability", and then are surprised when it hits them. And then a story leaks how someone was logged into another uses Facebook account. If you require them to always be unique then you will have to prefix each ID with something that will never repeat - like current date and time with microseconds. And if that is not good enough, because there still is a even tinier chance of a collision, you can create a small application that will generate those prefixes, and will add an counter (incremented after each hash request, and reset every couple seconds) to the date and microseconds. It will have to work in single-threaded mode, but this will be a guarantee to generate unique prefixes that won't collide.
0
1
0
0
2014-10-29T18:06:00.000
1
1.2
true
26,637,631
0
0
1
1
I'm using celery with django and am storing the task results in the DB. I'm considering having a single set of workers reading messages from a single message broker. Now I can have multiple clients submitting celery tasks and each client will have tasks and their results created/stored in a different DB. Even though the workers are common, they know which DB to operate upon for each task. Can I have duplicate task ids generated because they were submitted by different clients pointing to different DBs? Thanks,
Python: how to read 'Chunked Transfer Coding' from a request in web.py server
26,651,096
-1
1
599
0
python,web.py
web.py runs CherryPy as the web server and it has support for handling requests with chunked transfer coding. Have you misread the documentation?
0
0
1
0
2014-10-30T09:38:00.000
2
-0.099668
false
26,649,495
0
0
1
1
I am using web.py to run a server. I need to get a request from a remote server, however, the request sends me a data with Chunked Transfer Coding. I can use web.ctx.env['wsgi.input'].read(1000) to get the data. But this is not what I need since I don't know the length of the data (because it is chunked). But if I use web.ctx.env['wsgi.input'].read() the server would crash. Can anybody tell me how to get the chunked data in a request?
urllib vs cloud storage (Google App Engine)
26,660,144
0
0
199
0
python,google-app-engine,parsing,google-cloud-storage,urllib
They will likely be very close. the AppEngine cloud storage library uses the URL fetch service, just like urllib. Nonetheless, like any performance tuning, I'd suggest measuring on your own.
0
1
1
0
2014-10-30T12:08:00.000
2
0
false
26,652,617
0
0
1
1
I'm developing an app (with Python and Google App Engine) that requires to load some content (basically text) stored in a bucket inside the Google Cloud Storage. Everything works as expected but I'm trying to optimize the application performance. I have two different options: I can parse the content via the urllib library (the content is public) and read it or I can load the content using the cloudstorage library provided by Google. My question is: in terms of performance, which method is better? Thank you all.
Could gunicorn cause an issue with exscript/paramiko?
29,862,343
1
10
436
0
python,django,gunicorn,paramiko,f5
Total guess, but perhaps this will be helpful in debugging. Basically, ensure you've removed all output buffering, which can often be hiding what is really happening when layering multiple big frameworks (like you are doing here). Ensure that you disable all output buffering in Python, both for your foreground webserver process and for any worker processes (setting PYTHONUNBUFFERED is an easy way to ensure that none of your python scripts have buffering, at least on the standard library functions). The terminal can also introduce buffers that make debugging exceptionally hard. Consider switching your command to stdbuf -o0 -e0 your command to disable buffers on stdout and stderr (your command could still re-enable them, but most programs do not).
0
0
0
0
2014-10-30T18:22:00.000
1
0.197375
false
26,660,542
0
0
1
1
I have a Django project running behind Nginx, and Gunicorn. One of the applications interacts with network devices using Exscript, which is in turn using Paramiko. Some devices do not work properly when they are behind Gunicorn. The same exact code will work fine from within the django-admin shell. It will also work if I launch the built in django server, but I still get the error if I bypass nginx, and connect directly to Gunicorn. I tried moving the functionality to a celery task, it had the same exact problem, but only behind Gunicorn. I wrote a script using django-extensions that works from the command line, but will fail if called via subprocess. But only behind Gunicorn. The devices that are failing all seem to be F5 LTMs, and it looks like the buffer on the exscript object is being modified somehow. If I had to guess I would say that Gunicorn, and Exscript/Paramiko are somehow stepping on each others memory, or perhaps Gunicorn is setting some environment variable that Exscript is picking up on. In any case I am thoroughly stumped, and would appreciate any guidance on how to troubleshooot this.
How to handle mqtt loop_forever function when using Django?
26,665,495
5
7
3,352
0
python,django,multithreading,mqtt,paho
Use the threaded interface to paho-mqtt instead. This starts a background thread to handle the network processing and can be accessed with loop_start(). Alternatively you could make your own thread and just call loop() yourself.
0
0
0
0
2014-10-30T20:12:00.000
1
1.2
true
26,662,422
0
0
1
1
I am working on a website and am using Django for development. I have a few devices that communicate to the website using MQTT, and I plan to use paho-mqtt client. My issue is that for paho-mqtt to function I must call a function that loops forever while paho-mqtt continues to listen for messages. What is the best way to have this loop called and contained in it's own thread? Can I just create a new thread, or should I use something like celery?
Using wsdl in pysimplesoap
26,923,483
1
0
448
0
python,wsdl,pysimplesoap
Probably that is because you must be using ver 1.10. Try a. comment out the line where you set trace = True or trace = False. Trace has been probably removed in ver 1.10. Or b. revert back to version 1.05a
0
0
0
0
2014-11-03T05:14:00.000
1
0.197375
false
26,708,170
0
0
1
1
Not able to view debugged output and when tried with trace, gives an error:init() got an unexpected keyword argument 'trace'
How to make flask response in one tcp packet?
26,717,670
1
2
299
0
python,flask
Flask is microframework, it is used for developing webapp or related stuff, Flask has its own response building way, you can not control response packets from flask. What you are talking is of different layer, it comes about networking layer.
0
0
1
0
2014-11-03T07:47:00.000
1
0.197375
false
26,709,879
0
0
1
1
I am using flask for a very simple app. The response is right but split into multiple tcp packets. It seems that flask put every http header in a tcp packet. Why flask response is split into multiple tcp packets? How do I disable this feature?