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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
accessing a MBean which is boolean in wlst
| 37,591,919 | 1 | 1 | 938 | 0 |
python,weblogic,mbeans,wlst
|
Try cmo.isPausedForForwarding().That works for me.
| 0 | 0 | 0 | 0 |
2013-07-13T23:57:00.000
| 3 | 0.066568 | false | 17,635,271 | 0 | 0 | 1 | 2 |
Need to access a boolean value under Store and Forward Agent ...
already inside the SAF_Agent and once i do a ls(), i see a list of operations and attributes. I can perform the operations, but i am unable to get one of the attributes
the attribute is PausedForForwarding which is a boolean true or false which currently shows true which mean the SAF Agent is currently paused for forwarding
trying to check the status for above using
cmo.getPausedForForwarding()
and other options as well, but no luck, depending on the status, i want to pause or resume the SAF_Agent !!!
Help needed !!!
|
Browser Simulation and Scraping with windmill or selenium, how many http requests?
| 17,642,669 | 0 | 0 | 728 | 0 |
python,selenium,selenium-webdriver,httprequest,windmill
|
Selenium uses the browser but number of HTTP request is not one. There will be multiple HTTP request to the server for JS, CSS and Images (if any) mentioned in the HTML document.
If you want to scrape the page with single HTTP request, you need to use scrapers which only gets what is present in the HTML source. If you are using Python, check out BeautifulSoup.
| 0 | 0 | 1 | 0 |
2013-07-14T12:16:00.000
| 1 | 0 | false | 17,639,299 | 0 | 0 | 1 | 1 |
I want to use windmill or selenium to simulate a browser that visits a website, scrapes the content and after analyzing the content goes on with some action depending of the analysis.
As an example. The browser visits a website, where we can find, say 50 links. While the browser is still running, a python script for example can analyze the found links and decides on what link the browser should click.
My big question is with how many http Requests this can be done using windmill or selenium. I mean do these two programs can simulate visiting a website in a browser and scrape the content with just one http request, or would they use another internal request to the website for getting the links, while the browser is still running?
Thx alot!
|
Flask - How do I read the raw body in a POST request when the content type is "application/x-www-form-urlencoded"
| 46,003,806 | 11 | 17 | 23,453 | 0 |
python,ajax,post,flask
|
Use request.get_data() to get the POST data. This works independent of whether the data has content type application/x-www-form-urlencoded or application/octet-stream.
| 0 | 0 | 1 | 0 |
2013-07-14T15:15:00.000
| 4 | 1 | false | 17,640,687 | 0 | 0 | 1 | 1 |
Turns out that Flask sets request.data to an empty string if the content type of the request is application/x-www-form-urlencoded. Since I'm using a JSON body request, I just want to parse the json or force Flask to parse it and return request.json.
This is needed because changing the AJAX content type forces an HTTP OPTION request, which complicates the back-end.
How do I make Flask return the raw data in the request object?
|
get image frames webcam from server with selenium python script
| 17,718,816 | 0 | 0 | 439 | 0 |
python-2.7,selenium,selenium-webdriver
|
First, what you'll need to do is navigate to the webpage with Selenium.
Then, analyse the web page source HTML which the Javascript will have rendered by you navigating to the page, to get the image URL. You can do this with Selenium or with an HTML parser.
Then you can easily download the image using wget or some other URL grabber.
You might not even need Selenium to accomplish this if when you get the page, the image is already there. If that is the case you can just use the URL grabber to get the page directly.
Let me know if you want more details or if you have any questions.
| 0 | 0 | 1 | 0 |
2013-07-14T16:47:00.000
| 1 | 1.2 | true | 17,641,441 | 0 | 0 | 1 | 1 |
I need to take image frames from a webcam server using selenium python module.
The frames webcam is show on the selenium browser ( using http:// .....html webpage) .
The source code of the page show me it's done using some java script.
I try to use:
capture_network_traffic() and captureNetworkTraffic
Not working , also I don't think is a good way to do that.
Also I don't want to use capture_screenshot functions , this take all canvas of the browser.
Any idea ?
Thank you. Regards.
|
Where should I keep the authentication settings when using Scrapy?
| 17,644,278 | 1 | 1 | 96 | 0 |
python,scrapy
|
The "standard" is to use the environment. Depending on what environment you're running in you may not always be guaranteed a filesystem, however env vars are usually present in most application environments.
| 0 | 0 | 1 | 0 |
2013-07-14T21:35:00.000
| 1 | 0.197375 | false | 17,644,019 | 0 | 0 | 1 | 1 |
I have a working Scrapy scraper that does a login before proceeding to parse and retrieve data but I want to open source it with exposing my username/password. Where should I factor these out to?
I was thinking of either storing them in ENV and then accessing them via os.environ, putting them in a settings.local.py file that is imported into settings.py, or just having a configuration file that is read by settings.py.
|
when to use pre_save, save, post_save in django?
| 39,893,085 | 5 | 33 | 24,676 | 0 |
python,django,django-models,django-signals
|
Don't forget about recursions risk.
If you use post_save method with instance.save() calling, instead of .update method, you should disconnect your post_save signal:
Signal.disconnect(receiver=None, sender=None,
dispatch_uid=None)[source] To disconnect a receiver from a signal,
call Signal.disconnect(). The arguments are as described in
Signal.connect(). The method returns True if a receiver was
disconnected and False if not.
The receiver argument indicates the registered receiver to disconnect.
It may be None if dispatch_uid is used to identify the receiver.
... and connect it again after.
update() method don't send pre_ and post_ signals, keep it in mind.
| 0 | 0 | 0 | 0 |
2013-07-15T02:09:00.000
| 3 | 0.321513 | false | 17,645,801 | 0 | 0 | 1 | 1 |
I see I can override or define pre_save, save, post_save to do what I want when a model instance gets saved.
Which one is preferred in which situation and why?
|
cant download files uploaded tree.io
| 17,730,860 | 1 | 2 | 109 | 0 |
python,django,apache,treeio-django
|
after sometime found a solution for this.
i had to define the MEDIA_ROOT as an absolute URL in the settings.py
when i went to static/media there was no folder called attachments, i had to make one and give it the correct permissions for python can write to that folder.
this worked for me.
| 0 | 0 | 1 | 0 |
2013-07-15T11:47:00.000
| 1 | 1.2 | true | 17,653,546 | 0 | 0 | 1 | 1 |
All the files I upload to the tree.io tickets, projects, etc cannot be downloaded,
I am getting a 404 error.
I am running tree.io in a cantos 6 box.
any ideas to get this working please ?
|
Logging User Login in App Engine
| 17,655,687 | 0 | 0 | 35 | 0 |
google-app-engine,python-2.7
|
Log only if its been some time since they entered the app.
if you really want to do it at the login level hou can but you will need to setup SSO on the domain.
| 0 | 1 | 0 | 0 |
2013-07-15T11:54:00.000
| 1 | 0 | false | 17,653,659 | 0 | 0 | 1 | 1 |
I have a Python application on AppEngine that requires users to log in.
Is there any way to write a log entry on logging in?
Users could hit the log in screen from any URL and will reload pages throughout their session so adding it to code would add numerous entries when all I want is one at the point of authentication.
|
Heroku - Flask - Bcrypt error
| 32,994,904 | 0 | 2 | 773 | 0 |
python,flask
|
Add cffi or cryptography in requirements.txt .That solved the problem in my case.
| 0 | 0 | 0 | 1 |
2013-07-15T16:32:00.000
| 3 | 0 | false | 17,659,176 | 0 | 0 | 1 | 2 |
I am attempting to deploy a flask app on Heroku and it always errors at the same place. GCC fails to install and compile the Bcrypt module so I removed it from my requirements.txt (it is not used in the app). When I view the requrements.txt file, there is no mention of Bcrypt but when I push to heroku, it still tries to install it. I have committed the most recent version of requirements.txt to Git. Any help would be greatly appreciated.
|
Heroku - Flask - Bcrypt error
| 20,009,155 | 0 | 2 | 773 | 0 |
python,flask
|
I was able to get around it kind of, by successfully installing the following: "Successfully installed z3c.bcrypt python-bcrypt py-bcrypt-w32". Installing one of these (likely the second one) is what probably included the main bcrypt library that I guess needed to be compiled? I not 100% sure... I noticed this post is from July, I was able to download those libraries all using PIP.
| 0 | 0 | 0 | 1 |
2013-07-15T16:32:00.000
| 3 | 0 | false | 17,659,176 | 0 | 0 | 1 | 2 |
I am attempting to deploy a flask app on Heroku and it always errors at the same place. GCC fails to install and compile the Bcrypt module so I removed it from my requirements.txt (it is not used in the app). When I view the requrements.txt file, there is no mention of Bcrypt but when I push to heroku, it still tries to install it. I have committed the most recent version of requirements.txt to Git. Any help would be greatly appreciated.
|
Delete entities from a datastore table without knowing ancestor
| 17,659,738 | 2 | 1 | 80 | 0 |
python,google-app-engine,app-engine-ndb
|
Provided you have indexed them to be queried by date, you can query the entities by date.
The query will return the entities of interest. You can find out the ancestor of a given entity from its key - the ancestor's key is part of the entity's key.
| 0 | 1 | 0 | 0 |
2013-07-15T16:49:00.000
| 1 | 1.2 | true | 17,659,500 | 0 | 0 | 1 | 1 |
Is it possible to delete entities from a datastore table without knowing their ancestor? I wish to delete all entities older than a specific date, but there are many different ancestors.
|
Gathering information from few forms in django
| 17,663,244 | 0 | 3 | 79 | 0 |
python,django,django-forms,formset
|
I just come up with an idea, that I can create in first form additional hidden fields, which can be synchronized with fields from second form by JavaScript. This will create small redundancy, however seems to be very easy to implement.
Is it a good idea?
| 0 | 0 | 0 | 0 |
2013-07-15T19:54:00.000
| 2 | 0 | false | 17,662,714 | 0 | 0 | 1 | 1 |
I am creating simple search engine, so I have one input text field on the top of the page and buttom "search" next to it. That is all in one form, and "produce" for instance/q=search%20query.
In sidebar I have panel with another form with filters, lets say from, to. I want to have a possibility of creating link like /q=search%20query&from=20&to=50. I wonder how button from first form should gather information from second form.
I read somewhere that there is something like formsets, however I didn't find information that they can be used to something like that.
|
Python webdriver to handle pop up browser windows which is not an alert
| 17,676,233 | 8 | 31 | 84,462 | 0 |
python,selenium,webdriver
|
If its a new window or an iframe you should use the driver.switch_to_frame(webelement) or driver.switch_to_window(window_name). This should then allow you to interact with the elements within the popup.
After you've finished, you should then driver.switch_to_default_content() to return to the main webpage.
| 0 | 0 | 1 | 0 |
2013-07-16T12:02:00.000
| 2 | 1 | false | 17,676,036 | 0 | 0 | 1 | 1 |
I am working on a web application, in which clicking on some link another popup windows appears. The pop windows is not an alert but its a form with various fields to be entered by user and click "Next".
How can I handle/automate this popup windows using selenium.
Summary :-
Click on the hyperlink (url) - "CLICK HERE"
A user registration form appears as a pop up
A data is to be filled by user
Click Next/Submit button.
Another next redirected to another page/form 'User Personal Information Page'
Personal information is to be filled by user
Click "Next/Submit"
Popup disappeared.
Now further processing on original/Base page.
|
How can I manage separate app.yaml / cron.yaml for my app engine source code?
| 17,686,245 | 0 | 1 | 169 | 0 |
google-app-engine,python-2.7,google-analytics
|
I've been using two branches where the app.yaml files are different. But it requires that I have to be careful when merging and explicitly NOT merge the app.yaml file. It's still a pain.
| 0 | 1 | 0 | 0 |
2013-07-16T15:49:00.000
| 1 | 0 | false | 17,681,217 | 0 | 0 | 1 | 1 |
I have two versions of my app, prod and dev that I manage from one git repo. The way I've been managing them is to constantly switch and uncomment lines in both my app.yaml and my cron.yaml depending upon which version I want to upload.
I was wondering if anyone had better experience managing two different versions within one git repo.
|
PyCharm - some breakpoints not working in a Django project
| 67,087,404 | 2 | 9 | 6,842 | 0 |
python,django,breakpoints,pycharm
|
In my case, setting the "No reload" option in the run/debug configuration solved the problem. I'm using python 3.8.
| 0 | 0 | 0 | 0 |
2013-07-16T16:12:00.000
| 5 | 0.07983 | false | 17,681,731 | 0 | 0 | 1 | 4 |
I'm seeing some bizarre behaviour in PyCharm. I have a Django project where breakpoints stopped working in some files but not others. For example, all the breakpoints in my app's views.py work fine, but all the breakpoints in that same app's models.py are just ignored.
I've tried the following but no joy:
double-check the breakpoints are enabled
removing/re-adding the breakpoints
closed/re-opened the project
quit & re-launch PyCharm
delete my configuration and create a new one
Some details:
PyCharm 2.7.3
Python 2.7.2 (within virtualenv)
Django 1.5.1
I'm not using any special settings in my configuration. Any ideas?
|
PyCharm - some breakpoints not working in a Django project
| 23,372,427 | 13 | 9 | 6,842 | 0 |
python,django,breakpoints,pycharm
|
If you have the setting "Gevent compatible debugging" enabled it does not seem to hit breakpoints in a non-Gevent django application.
Find it under Preferences -> Python Debugger -> Gevent compatible debugging
| 0 | 0 | 0 | 0 |
2013-07-16T16:12:00.000
| 5 | 1 | false | 17,681,731 | 0 | 0 | 1 | 4 |
I'm seeing some bizarre behaviour in PyCharm. I have a Django project where breakpoints stopped working in some files but not others. For example, all the breakpoints in my app's views.py work fine, but all the breakpoints in that same app's models.py are just ignored.
I've tried the following but no joy:
double-check the breakpoints are enabled
removing/re-adding the breakpoints
closed/re-opened the project
quit & re-launch PyCharm
delete my configuration and create a new one
Some details:
PyCharm 2.7.3
Python 2.7.2 (within virtualenv)
Django 1.5.1
I'm not using any special settings in my configuration. Any ideas?
|
PyCharm - some breakpoints not working in a Django project
| 17,688,764 | 6 | 9 | 6,842 | 0 |
python,django,breakpoints,pycharm
|
While I don't know why or how, the problem was resolved by deleting the ".idea" directory within the Django project directory. This is where the PyCharm project data lives, so by removing this directory you will lose your project specific settings, so just be aware. Hope this helps someone else.
| 0 | 0 | 0 | 0 |
2013-07-16T16:12:00.000
| 5 | 1.2 | true | 17,681,731 | 0 | 0 | 1 | 4 |
I'm seeing some bizarre behaviour in PyCharm. I have a Django project where breakpoints stopped working in some files but not others. For example, all the breakpoints in my app's views.py work fine, but all the breakpoints in that same app's models.py are just ignored.
I've tried the following but no joy:
double-check the breakpoints are enabled
removing/re-adding the breakpoints
closed/re-opened the project
quit & re-launch PyCharm
delete my configuration and create a new one
Some details:
PyCharm 2.7.3
Python 2.7.2 (within virtualenv)
Django 1.5.1
I'm not using any special settings in my configuration. Any ideas?
|
PyCharm - some breakpoints not working in a Django project
| 65,536,326 | -1 | 9 | 6,842 | 0 |
python,django,breakpoints,pycharm
|
Just like other folders on the left side of your project, there will be a '.idea' folder on the top must be there. Delete that '.idea folder'. Close the project. Open it again. It solved my issues.
| 0 | 0 | 0 | 0 |
2013-07-16T16:12:00.000
| 5 | -0.039979 | false | 17,681,731 | 0 | 0 | 1 | 4 |
I'm seeing some bizarre behaviour in PyCharm. I have a Django project where breakpoints stopped working in some files but not others. For example, all the breakpoints in my app's views.py work fine, but all the breakpoints in that same app's models.py are just ignored.
I've tried the following but no joy:
double-check the breakpoints are enabled
removing/re-adding the breakpoints
closed/re-opened the project
quit & re-launch PyCharm
delete my configuration and create a new one
Some details:
PyCharm 2.7.3
Python 2.7.2 (within virtualenv)
Django 1.5.1
I'm not using any special settings in my configuration. Any ideas?
|
Do I need to SSH into EC2 instance in order to start custom script with arguments, or there are some service that I don't know
| 17,691,484 | 1 | 0 | 218 | 0 |
python,amazon,chef-infra,boto,aws-opsworks
|
You can use knife-bootstrap. This can be one way to do it. You can use AWS SDK to do most of it
Launch an instance
Add a public IP (if its not in VPC)
Wait for instance to come back online
use knife bootstrap to supply script, setup chef-client, update system
Then use chef cookbook to setup your machine
| 0 | 0 | 1 | 1 |
2013-07-16T21:04:00.000
| 2 | 0.099668 | false | 17,686,939 | 0 | 0 | 1 | 1 |
I need to create an application that will do the following:
Accept request via messaging system ( Done )
Process request and determine what script and what type of instance is required for the job ( Done )
Launch an EC2 instance
Upload custom script's (probably from github or may be S3 bucket)
Launch a script with a given argument.
The question is what is the most efficient way to do steps 3,4,5? Don't understand me wrong, right now I'm doing the same thing with script that does all of this
launch instance,
use user_data to download necessary dependencies
than SSH into instance and launch a script
My question is really: is that the only option how to handle this type of work? or may be there is an easy way to do this?
I was looking at OpsWork, and I'm not sure if this is the right thing for me. I know I can do steps 3 and 4 with it, but how about the rest? :
Launch a script with a given argument
Triger an OpsWork to launch an instance when request is came in
By the way I'm using Python, boto to communicate with AWS services.
|
Datastore vs Memcache for high request rate game
| 17,816,617 | 1 | 3 | 341 | 1 |
python,google-app-engine,memcached,google-cloud-datastore,app-engine-ndb
|
As a commenter on another answer noted, there are now two memcache offerings: shared and dedicated. Shared is the original service, and is still free. Dedicated is in preview, and presently costs $.12/GB hour.
Dedicated memcache allows you to have a certain amount of space set aside. However, it's important to understand that you can still experience partial or complete flushes at any time with dedicated memcache, due to things like machine reboots. Because of this, it's not a suitable replacement for the datastore.
However, it is true that you can greatly reduce your datastore usage with judicious use of memcache. Using it as a write-through cache, for example, can greatly reduce your datastore reads (albeit not the writes).
Hope this helps.
| 0 | 1 | 0 | 0 |
2013-07-17T14:13:00.000
| 2 | 0.099668 | false | 17,702,165 | 0 | 0 | 1 | 1 |
I have been using the datastore with ndb for a multiplayer app. This appears to be using a lot of reads/writes and will undoubtedly go over quota and cost a substantial amount.
I was thinking of changing all the game data to be stored only in memcache. I understand that data stored here can be lost at any time, but as the data will only be needed for, at most, 10 minutes and as it's just a game, that wouldn't be too bad.
Am I right to move to solely use memcache, or is there a better method, and is memcache essentially 'free' short term data storage?
|
Push Notifications server to selected clients
| 17,719,764 | 1 | 1 | 1,317 | 0 |
php,python,rest
|
So basically you can query your server from client in some interval (interval ~ 0 == realtime) and ask, if it has some news.
Normally apache can't deal with long waiting connection, because of its thread/fork request processing model.
You can try switch to nginx, because it is using socket multiplexing (select/epoll/kqueue), so it can deal with many concurrent long waiting connections).
Or you can think about node.js and replace your php app with it, which is absolutely done for this purposes.
Nice solution is too some web framework/language + redis pub/sub functionality + node.js. You can normal requests your web application, but have too open connection to node.js server and node.js server will notice your client when needed. If you want to tell node.js about informing some clients, you can do it from your web app through redis pub/sub.
| 0 | 0 | 1 | 1 |
2013-07-18T09:16:00.000
| 2 | 0.099668 | false | 17,719,300 | 0 | 0 | 1 | 1 |
Currently I am using Web Application(LAMP stack) with REST API to communicate with clients(Python Desktop Application).
Clients can register with server and send states to server through REST API.
Now I need to push notifications to selected clients from web application(server).
My question is how can I send push notifications from server(php) and read it from clients(python).
|
Is it possible to generate reports with dynamic columns in OpenERP?
| 17,739,668 | 0 | 1 | 582 | 0 |
python,report,openerp
|
I hope you can use webkit reporting. Any other openerp reporting tools have its limitations for creating dynamic columns.
| 0 | 0 | 0 | 0 |
2013-07-18T17:38:00.000
| 2 | 0 | false | 17,730,406 | 0 | 0 | 1 | 1 |
I need to understand if it is possible to create reports with X number of columns. X will come from the amenities a hotel have for example. So it will change depending on the hotel selected from a wizard before generating the report.
Lets say Hotel XYZ has 5 amenities I need a report with 5 columns where I will show the payments each guest made for each amenity. Then Hotel YYY will have 10 amenities and I need to do the same but for all 10 amenities.
Will it be possible to code a report (I am currently using the OpenOffice plugin but anything that work would be fine) flexible enough to do this with OpenERP?
I am not asking how to do it, I just want to understand the possibilities and limitations.
Thanks!
|
how to deploy apps developed in virtual env
| 17,758,271 | 0 | 0 | 83 | 0 |
python,module,virtualenv
|
Uploading your virtualenv probably won't work. There is a good chance that something in the virtualenv is dependent on the exact file paths and versions that won't match from your machine to the virtual host.
You can upload the virtualenv tool, make a new virtualenv, and then install the version of flask you want inside that virtualenv.
| 0 | 0 | 0 | 0 |
2013-07-20T02:21:00.000
| 1 | 0 | false | 17,758,039 | 0 | 0 | 1 | 1 |
I have a flask based app, and it's now running with virtualenv on my dev machine. Now I want to deploy it to my virtual host. Sadly, this virtual host is running flask 0.6, and I want flask 0.10. I don't have enough privilege to upgrade it.
Can I just upload my whole virtual environment, and to use my own version of flask, and how?
My idea is change the PYTHONPATH, how to get rid of the old version and add the new into it?
Any help will be appreciated.
|
Implementing Universal Search in a Django Application
| 17,762,184 | 0 | 0 | 624 | 0 |
python,django,search,inheritance,django-forms
|
It seems like you just need to create another SearchView which takes the query and displays the results. I am not sure if the results have to be displayed differently depending on which page the search has been performed from but it does not seem like.
The form would not have anything to do with the other views. You could just hard code it in the base template.
| 0 | 0 | 0 | 0 |
2013-07-20T11:51:00.000
| 3 | 0 | false | 17,761,974 | 0 | 0 | 1 | 1 |
We have a large Django application made up of a large number of different views (some of which contain forms). As with most large applications, we use a base layout template that contains the common layout elements across the applications (mainly a header and a footer), which the templates for all of our views extend.
What we are looking to do is create a universal search box in our application, accessible on every page, which allows users to perform searches across the entire application, and want to place the search box inside the header, which involves placing a form inside our base layout template. This means that every view in our application will need to be able to handle the submission of this search form. Once this search form is submitted, we will need to redirect the user to another view containing the search results.
However, we are struggling to come up with a pattern to handle this. Does anyone know of functionality built into Django that will help us to build this? Failing that, can anyone suggest a good strategy for modifying our application so that we can handle this use-case without having to modify a large number of existing views (which we don't have the resources to do at the moment)?
Please note that the focus of this question is intended to be the best way to handle the submission of a form which appears in every view, and not strategies for implementing a universal search algorithm (which we have already figured out).
Ideas Explored So Far
Our first idea was to create a base View class that implements handling the universal search form submission, and have each of our views extend this. However, this is not possible because we already have views that inherit from a number of different Django view classes (TemplateView, ListView, FormView and DeleteView being some examples), and to be able to build our own common view class would mean either writing our own version of these Django view classes to inherit from our own view base class, or re-writing a large number of our views so they don't use the Django view classes.
Our next idea was to implement a mixin that would handle the universal search form submission, in an attempt to add this functionality to all our views in a way that allows us to continue using the different Django view classes. However, this brought to light two new problems: (a) how could we do this without modifying each of our views to become a form view, and (b) how can we do this in a way that allows the form handling logic to play nicely when mixed in to existing FormViews?
|
JavaScript is enabled in client browser in django or in python?
| 17,778,994 | 0 | 0 | 319 | 0 |
javascript,django,browser,python-2.7,client
|
Unfortunately, you can't do this unless trying a second request. There's no way to know this before actually interacting with the browser itself.
The closest I can think of is trying to set a cookie and store this information for future visits.
Hope it helps.
| 0 | 0 | 0 | 0 |
2013-07-22T02:12:00.000
| 2 | 0 | false | 17,778,972 | 0 | 0 | 1 | 2 |
I am trying to find a solution to detect if clients brower has javascript enabled or not.
Is there a way to check whether JavaScript is enabled in the client browser, in django if possible or in python?
|
JavaScript is enabled in client browser in django or in python?
| 32,660,783 | 0 | 0 | 319 | 0 |
javascript,django,browser,python-2.7,client
|
The right approach is to degrade gracefully, but that is not always possible especially with web app. Use a <noscript> tag to tell the user to re-enable javascript.
If you need a solution through django, set a cookie using JS and try to read it in the second request. If you dont see the cookie then JS is not enabled. However, as a first request it can't be detected.
| 0 | 0 | 0 | 0 |
2013-07-22T02:12:00.000
| 2 | 0 | false | 17,778,972 | 0 | 0 | 1 | 2 |
I am trying to find a solution to detect if clients brower has javascript enabled or not.
Is there a way to check whether JavaScript is enabled in the client browser, in django if possible or in python?
|
how to make dynamic field creation capability in openerp module?
| 17,897,177 | 0 | 0 | 228 | 0 |
python,eclipse,openerp
|
I can't think of any easy way of doing this. When OpenERP connects to a database it sets up a registry containing all models and all the fields and as part of this, loads the fields into the database, performs database refactoring etc. The idea is that it is simple to inherit existing models and add your fields that way but it does require coding.
I have done something similar where:
I predefined some fields on your model (field1, intfield1, charfield1 etc.).
Provide a model/form so the admin can say use intfield1 and give it a label of 'My Value'
Override fields_view_get on your model and change the XML to include your field with the correct label.
But this is tricky to get right. You will want to spend some time learning the elementtree module to do the XML manipulation in the fields_view_get.
| 0 | 0 | 1 | 0 |
2013-07-22T05:02:00.000
| 1 | 0 | false | 17,780,235 | 0 | 0 | 1 | 1 |
Hi I have created an openerp module using Python (eclipse) . I want to add a feature in my form so that admin will be able to create his own fields whenever and whatever he wants . I needed some guidance of how this will be done . As I am new to openerp , any help will be good to me . Thanks
Hopes for advice
|
Git check-out from ant target or python
| 17,787,947 | 1 | 0 | 106 | 0 |
python,git,ant,build
|
I would make with ant - it standard tool for Java-platform. May be generate ant from python or other one. Lack of this manner is not flexible of ant by comparison with Python.
Lack of Python-based solution is greater complexity of deployment in future: for linux good practice make packet, for Windows you have install python and libs manually.
| 0 | 0 | 0 | 1 |
2013-07-22T10:16:00.000
| 2 | 0.099668 | false | 17,785,000 | 0 | 0 | 1 | 1 |
During our build , we call ANT from our Python .For code checkout,We have two options to checkout code from Git.
Pull code directly from Python script
Make an ANT target to pull code , Call that target from Python.
Can anyone please brief about pros and cons of both approach. I am new to all three tech.
Thanks
|
How to create a function for a pop up in OpenERP
| 18,320,029 | 0 | 0 | 604 | 0 |
python,openerp
|
You can write a small wizard to do so.refer to openerp documentation for how to.
| 0 | 0 | 0 | 0 |
2013-07-22T13:38:00.000
| 1 | 0 | false | 17,789,071 | 0 | 0 | 1 | 1 |
I have created a button in debugging mode of OpenERP and want to display a message on click of that button.
This is the button Ex. then How to write an action on click of this button mainly the popup and message is required
|
Free PaaS without / with less port forwarding to bind to custom ports?
| 21,300,896 | 0 | 0 | 362 | 0 |
python-2.7,httprequest,openshift,paas
|
You can also bind to arbitrary ports as long as you either want to talk out on that port or want to only consume it internally. For example some people write IRC bots using OpenShift, which goes out on port 6666 or 6667. If you want to have something listening to requests that come from outside openshift then you can only bind to 8080
| 0 | 1 | 0 | 0 |
2013-07-23T03:00:00.000
| 2 | 0 | false | 17,800,796 | 0 | 0 | 1 | 2 |
I am currently engaged in a project which has the following requirements.
The application is written in Python,
The Application has two threads running at any instance, one is the 'server' and the other is the 'app-logic'.
The server listens on port 6000 (or any such custom port) and reads the incoming message (which is plain text commands), then passes that message to app-logic,which then processes the input, creates an output, and then passes the outbound message to the server.
The server then writes to the port 7000 of the client(or any such fixed port, the client is specially made to read from their aforementioned port)
So far I have tried The Google-App-Engine and let it go because of issues regarding Threading. I tried OpenShift and they did not support binding to a custom port. They only supported binding to port 8080 (which is fine), but to that, they had forwarded traffic from somewhere else. So as it turns out, the 'server' in my application reads the inbound stream is from a different port of the same machine that I have been allocated for the site, and since the messages are not HTTP format, I have no way of writing back to the client.
Is there any PaaS that supports an app of this nature??
Update: I have finished the project some time back using Openshift. It was a piece of cake to work around this problem that I had once we use a third party messaging service such as pubnub or pusher.
|
Free PaaS without / with less port forwarding to bind to custom ports?
| 18,064,738 | 0 | 0 | 362 | 0 |
python-2.7,httprequest,openshift,paas
|
I have found one way! That is to use the DIY cartridge (Do it yourself) in Openshift, install Python and run "Websockets". Of course this still means that the transmissions should be of HTTP.
The other option is to move to IaaS (infrastructure as a service) rather than PaaS.
| 0 | 1 | 0 | 0 |
2013-07-23T03:00:00.000
| 2 | 0 | false | 17,800,796 | 0 | 0 | 1 | 2 |
I am currently engaged in a project which has the following requirements.
The application is written in Python,
The Application has two threads running at any instance, one is the 'server' and the other is the 'app-logic'.
The server listens on port 6000 (or any such custom port) and reads the incoming message (which is plain text commands), then passes that message to app-logic,which then processes the input, creates an output, and then passes the outbound message to the server.
The server then writes to the port 7000 of the client(or any such fixed port, the client is specially made to read from their aforementioned port)
So far I have tried The Google-App-Engine and let it go because of issues regarding Threading. I tried OpenShift and they did not support binding to a custom port. They only supported binding to port 8080 (which is fine), but to that, they had forwarded traffic from somewhere else. So as it turns out, the 'server' in my application reads the inbound stream is from a different port of the same machine that I have been allocated for the site, and since the messages are not HTTP format, I have no way of writing back to the client.
Is there any PaaS that supports an app of this nature??
Update: I have finished the project some time back using Openshift. It was a piece of cake to work around this problem that I had once we use a third party messaging service such as pubnub or pusher.
|
Best practices for management of a developer system on Mac OS X for non-developers
| 17,810,311 | 0 | 2 | 673 | 0 |
python,ruby,macos
|
If all that you are worried about is quickly setting up a new machine, use a backup software to setup the new machine. You can also try to use a custom time machine setup with just the folders that you are interested it.
| 0 | 0 | 0 | 1 |
2013-07-23T09:09:00.000
| 3 | 0 | false | 17,805,952 | 0 | 0 | 1 | 2 |
I'm a designer who writes mostly Sass, Less (CSS pre-processors), HTML, Javascript and usually starts off with static site generators such as Jekyll, Yeoman, etc. While working with developers who code in Python, Ruby, Clojure, I help with the templates. In my free time, I design wordpress themes and write plugins in PHP. I run grunt regularly and bower helps me with components that I need for my designs.
This means my system is littered with Ruby Gems, Python libraries, Node Modules. They are either installed via gem installations, pip, brew or npm. Now you realize that my system is a mess even though it works. I really want to do stuffs in a sane manner, the right way.
So, what are the best practices for installation and management of all the libraries, core tools, etc. for a developer on Mac OS X. Point me to resources that I can read, ponder and practice.
Here is the scenario. You're a seasoned developer and I'm your friend who just got a new Mac OS X system. I'm a designer who will work with Python (mostly with Django), Ruby (with Rails), Clojure, PHP, Sass, Less, Compass, CoffeeScript, Git, NodeJS, Grunt, Bower, Jekyll, Yeoman and alike. As a friend, you know that I'm not a 'programmer' but a developer-friendly 'designer'. How can you help me setup my Mac? And I don't want to come back again when I get a new Mac in future, I should be able to just transition smoothly from my old setup.
Thanking in anticipation.
|
Best practices for management of a developer system on Mac OS X for non-developers
| 17,808,568 | 0 | 2 | 673 | 0 |
python,ruby,macos
|
I am not sure what you meant by "How can you help me setup my Mac?". It seems that you are very much comfortable installing all the dependencies(gems and all) for your projects. If you want to automate all these environment installation setup then you may go ahead and write a generic shell script to install ruby, python and other stuff and reuse when you have a new machine :) and it has nothing to do with Mac OSX or any other OS. You just need to put correct package/version to fetch and install/compile accordingly in the script.
Would be great if you can put a specific question here in case you are facing technical problem installing any of the above packages.
| 0 | 0 | 0 | 1 |
2013-07-23T09:09:00.000
| 3 | 0 | false | 17,805,952 | 0 | 0 | 1 | 2 |
I'm a designer who writes mostly Sass, Less (CSS pre-processors), HTML, Javascript and usually starts off with static site generators such as Jekyll, Yeoman, etc. While working with developers who code in Python, Ruby, Clojure, I help with the templates. In my free time, I design wordpress themes and write plugins in PHP. I run grunt regularly and bower helps me with components that I need for my designs.
This means my system is littered with Ruby Gems, Python libraries, Node Modules. They are either installed via gem installations, pip, brew or npm. Now you realize that my system is a mess even though it works. I really want to do stuffs in a sane manner, the right way.
So, what are the best practices for installation and management of all the libraries, core tools, etc. for a developer on Mac OS X. Point me to resources that I can read, ponder and practice.
Here is the scenario. You're a seasoned developer and I'm your friend who just got a new Mac OS X system. I'm a designer who will work with Python (mostly with Django), Ruby (with Rails), Clojure, PHP, Sass, Less, Compass, CoffeeScript, Git, NodeJS, Grunt, Bower, Jekyll, Yeoman and alike. As a friend, you know that I'm not a 'programmer' but a developer-friendly 'designer'. How can you help me setup my Mac? And I don't want to come back again when I get a new Mac in future, I should be able to just transition smoothly from my old setup.
Thanking in anticipation.
|
How to use a recaptcha custom theme with Flask-WTF
| 17,856,425 | 0 | 1 | 1,772 | 0 |
python,flask,recaptcha,flask-wtforms
|
After a couple hours trying to get a custom design working I couldn't make it work. Flask-WTF outputs all the html and javascript code for the recaptcha to work. You can't change its behavior without editing the extension code itself.
| 0 | 0 | 0 | 0 |
2013-07-23T10:52:00.000
| 3 | 0 | false | 17,808,137 | 0 | 0 | 1 | 1 |
I'm trying to customize the recaptcha inside my form, but I only get a javascript error. Can it be made, or do I have to modify the Flask-WTF code myself?
|
Switch Django's version
| 17,820,118 | 1 | 0 | 1,815 | 0 |
python,django,virtualenv
|
Yes. Use virtualenv to install each project in its own isolated environment, with its own installation of libraries.
| 0 | 0 | 0 | 0 |
2013-07-23T20:06:00.000
| 3 | 0.066568 | false | 17,820,037 | 0 | 0 | 1 | 1 |
I'm using different Django framework version(1.3, 1.4, 1.5) for different projects.
On my laptop, I have to reinstall Django with pip, every time I want to switch to another project.
Is there an easier(less stupid! :D) way, that i can automatically switch to the version I need? Something like NVM for node?
|
Websocket connection between two servers
| 17,835,810 | 0 | 0 | 1,390 | 0 |
python-2.7,websocket,tornado
|
WebSocket was designed for low-latency bidirectional browser<->service communication. It's placed on top of TCP/IP and brings along some overhead. It was designed to solve all the problems that you simply do not have when it's about front-end<->back-end communication, because there we're talking about a defined environment which is under your control. Hence, I would recommend going back to the basics and do simple TCP/IP communication between your front-end and back-end.
| 0 | 1 | 1 | 0 |
2013-07-24T03:07:00.000
| 2 | 0 | false | 17,824,526 | 0 | 0 | 1 | 1 |
Im using python tornado as web server and I have a backend server and a frontend server. I want to create browser-frontend-backend connection. Can anyone help me how to do this? I know how to create websocket connection between frontend and browser but I have no idea how to connect my frontend server to backend server to stream realtime data parsed by my backend server.
|
python bottle deciding on return mimetype
| 17,832,612 | 0 | 0 | 377 | 0 |
python,format,return,bottle
|
The Request Mime-type(or content-type) is the type of the content being sent to the server - it does not mean this is the same type that should be returned by the server.
The client should know what the server Response type is going to be, and not otherwise - the server should not "guess" what response the client wants.
| 0 | 0 | 1 | 0 |
2013-07-24T10:02:00.000
| 2 | 0 | false | 17,830,806 | 0 | 0 | 1 | 1 |
I am using bottle for a POC restful service project. would someone kindly let me know what is the best way to decide if the caller wants me to send the response in JSON, XML, or HTML? I have seen some examples of this using request.mimetypes.best_match, but that needs me to import flask. is there a way to do this in bottle itself?
Thanks a lot,
Reza
|
Do debug messages being displayed on production server?
| 17,834,315 | 0 | 0 | 124 | 0 |
python,django
|
When DEBUG=False Error messages wont appear on site.You will get email to mails listed in 'ADMINS' settings in the "settings.py" file.
| 0 | 0 | 0 | 0 |
2013-07-24T11:04:00.000
| 2 | 0 | false | 17,832,132 | 0 | 0 | 1 | 2 |
Let's say I have console handler that prints DEBUG messages to console.
On production server where DEBUG=False, do debug messages displayed on console? Or they're only valid on development machine.
|
Do debug messages being displayed on production server?
| 17,853,247 | 1 | 0 | 124 | 0 |
python,django
|
Django prints to apache's error.log when DEBUG=False.
| 0 | 0 | 0 | 0 |
2013-07-24T11:04:00.000
| 2 | 0.099668 | false | 17,832,132 | 0 | 0 | 1 | 2 |
Let's say I have console handler that prints DEBUG messages to console.
On production server where DEBUG=False, do debug messages displayed on console? Or they're only valid on development machine.
|
Edit a file outside the web root
| 17,833,204 | 1 | 0 | 126 | 0 |
php,python,cgi
|
Probably by bind mounts (assuming Linux), so that the file is in it's original location as well as in the web root.
Or by priviledge separation. The web root sends a query to some worker job, that has access to all the needed files.
| 0 | 0 | 0 | 0 |
2013-07-24T11:40:00.000
| 1 | 1.2 | true | 17,832,954 | 0 | 0 | 1 | 1 |
I have developed a python desktop application and application itself having setup page to change some configurations in the application and it is saved as a configuration file.
Now I need do to give web interface to change those configurations by using web browser remotely. But I need to change the same configuration file.
I can’t access any file outside the web root, So My first question is how can I edit that file which is located outside the web root.
more info : for web application I use LAMP stack and desktop application is python based.
someone suggest me to use CGI, Second question : Is that possible, if it is possible how I can I do it?
|
Django virtualenv layout
| 17,837,797 | 1 | 15 | 6,964 | 0 |
python,django,virtualenv
|
This goes to the very heart of how you use virtualenv: cd to the virtualenv directory, then activate it (or the other way around - it doesn't really matter). The usual way to do this on linux (or cygwin) is to source ./bin/activate/ from inside the virtualenv.
At that point, if you use pip or python they will be local to that virtualenv. You should only perform your installations, and run your stuff after activating the virtualenv.
So, to answer your question: switch and activate before you start to install or do anything. Do everything inside the virtualenv, with it activated.
| 0 | 0 | 0 | 0 |
2013-07-24T14:57:00.000
| 3 | 0.066568 | false | 17,837,723 | 1 | 0 | 1 | 1 |
I am very new to django. I just have a very basic question about project layout using virtualenv. When we create virtualenv and install all the dependencies-django etc, do I need to switch my directory to the virtualenv and then create a project there? Or do I need to create my project outside of virtualenv. I apologize if it is a very basic question.
|
Google App Engine Remote API + OAuth
| 20,981,524 | 0 | 5 | 907 | 0 |
python,google-app-engine,oauth-2.0,google-oauth
|
You can't use OAuth2 to connect to your app with remote_api_stub/shell. This option is not provided.
| 0 | 1 | 1 | 0 |
2013-07-25T11:45:00.000
| 2 | 0 | false | 17,857,138 | 0 | 0 | 1 | 1 |
I'm using GAE remote api to access the data store of my app. The authentication to GAE is made using remote_api_stub.ConfigureRemoteApi with an authentication function that returns a user name and a password.
Is there a way for authenticating using an access_token, for example OAuth or OAuth 2.0?
|
Switching between editor and console in PyDev
| 17,857,465 | 1 | 0 | 264 | 0 |
python,eclipse,pydev
|
In the preferences of Eclipse, go to "PyDev/Editor/Interactive Console" and uncheck "Focus console when an evaluate command is sent from the editor". This will leave the focus in the editor, while evaluating the code in the console.
| 0 | 0 | 0 | 0 |
2013-07-25T11:49:00.000
| 1 | 1.2 | true | 17,857,189 | 1 | 0 | 1 | 1 |
I usually use the key combination Ctrl+Alt+Enter to send a code selection from the Eclipse (Juno) PyDev editor to the interactive console. But this passes control to the console.
I was wondering if there is any way to automatically (or using a shortcut) return control to the code editor.
|
Refresh Webpage using python
| 17,868,479 | 1 | 2 | 3,417 | 0 |
python,html,refresh
|
Without diving into complex modern things like WebSockets, there's no way for the server to 'push' a notice to a web browser. What you can do, however, it make the client check for updates in a way that is not visible to the user.
It will involve writing Javascript & writing an extra file. When writing your main webpage, add, inside Javascript, a timestamp (Unix timestamp will be easiest here). You also write that same timestamp to a file on the web server (let's call it updatetime.txt). Using an AJAX request on the page, you pull in updatetime.txt & see if the number in the file is bigger than the number stored when you generate the document, refresh the page if you see an updated time. You can alter how 'instantly' the changes get noticed but controlling how quickly you poll.
I won't go into too much detail on writing the code but I'd probably just use $.ajax() from JQuery (even though it's sort of overkill for one function) to make the calls. The trick to putting something on a time in JS is setinterval. You should be able to find plenty of documentation on using both of them already written.
| 0 | 0 | 1 | 0 |
2013-07-25T19:50:00.000
| 1 | 1.2 | true | 17,867,471 | 0 | 0 | 1 | 1 |
I have a webpage showing some data. I have a python script that continuously updates the data(fetches the data from database, and writes it to the html page).It takes about 5 minutes for the script to fetch the data. I have the html page set to refresh every 60 seconds using the meta tag. However, I want to change this and have the page refresh as soon as the python script updates it, so basically I need to add some code to my python script that refreshes the html page as soon as it's done writing to it.
Is this possible ?
|
What is the difference between Scrapy's spider middleware and downloader middleware?
| 17,872,865 | 21 | 18 | 3,140 | 0 |
python,scrapy,web-crawler
|
While they have almost identical interfaces, they serve different purposes:
Downloader middlewares modify requests and responses or generate requests in response to responses. They don't directly interact with spiders. Some examples are middlewares that implement cookies, caching, proxies, redirects, setting user-agent headers, etc. They just add functionality to the downloader system.
Spider middlewares modify things that pass in and out of spiders, like requests, items, exceptions, and start_requests. They do share some basic functionality with downloader middlewares, but they can't generate requests in response to responses. They stand between the spiders and the downloader. One example is filtering out responses with bad HTTP status codes.
Some middlewares can function as either a downloader middleware or a spider middleware, but they're often trivial and will be forced into one category or the other once you add more complex functionality.
| 0 | 0 | 1 | 0 |
2013-07-26T04:10:00.000
| 1 | 1.2 | true | 17,872,753 | 0 | 0 | 1 | 1 |
Both middleware can process Request and Response. But what is the difference?
|
Escape quotes in Javascript/Chameleon template
| 17,876,341 | 1 | 0 | 414 | 0 |
javascript,python,chameleon
|
You need to JSON encode the dictionary. You don't then need to put quotes around the dictionary, and JavaScript will see it as a JavaScript object.
| 0 | 0 | 0 | 0 |
2013-07-26T07:39:00.000
| 3 | 0.066568 | false | 17,875,627 | 0 | 0 | 1 | 2 |
I am trying to pass a python dictionary from a chameleon template to a javascript function. But since the dictionary contains single quotes or ' which need to be escaped I get an error in firebug that says : SyntaxError: missing ) after argument list.
My code looks like this:
<div id = "divsfp">
<input type="button" id="sfp" value="SFP"
onclick="get_sfp('${dict_value}')"></input></div>
Where dict_value is a python dictionary. How can I escpae ' in chameleon template before passing the data or in Javascript function itself?
|
Escape quotes in Javascript/Chameleon template
| 17,876,140 | 0 | 0 | 414 | 0 |
javascript,python,chameleon
|
You can try this, if this helps
"get_sfp('"+${dict_value}+"')"
Also from your implementation it seems that the dict_value is the variable you already know. So whats the problem accessing it from the get_sfp function.
Sorry couldn't comment as I still don't have that privilege.
| 0 | 0 | 0 | 0 |
2013-07-26T07:39:00.000
| 3 | 0 | false | 17,875,627 | 0 | 0 | 1 | 2 |
I am trying to pass a python dictionary from a chameleon template to a javascript function. But since the dictionary contains single quotes or ' which need to be escaped I get an error in firebug that says : SyntaxError: missing ) after argument list.
My code looks like this:
<div id = "divsfp">
<input type="button" id="sfp" value="SFP"
onclick="get_sfp('${dict_value}')"></input></div>
Where dict_value is a python dictionary. How can I escpae ' in chameleon template before passing the data or in Javascript function itself?
|
Passing paramaters to flask __init__.py
| 17,984,932 | 0 | 0 | 236 | 0 |
python-2.7,configuration,flask
|
The solution hybrid solution between my inital plan and Seans suggestion. I use multiple config files and set a environment variable before each kind of app instance. This means that you need to use
from os import environ
environ["APP_SETTINGS"] = "config.py"
before every import app call. The best approach to this problem is to use flask-script as Sean suggests and to have a python manage.py request where request could range from
run_unit_tests to run_server
and that manage script sets the environment variable (as well as builds the database, sets up a profiler, or anything else you need).
| 0 | 0 | 0 | 1 |
2013-07-27T00:39:00.000
| 1 | 1.2 | true | 17,893,099 | 0 | 0 | 1 | 1 |
I have a flask application that I would like to operate different when in production, unit testing, functional testing, and performance testing. Flasks one debug operation doesn't cover what I want to do, I was wondering if there is any way to pass parameters to flasks __init__.py.
I have several different scripts which build my app and create my data structures.
I know I can do this using environment variables but I was hoping for a better solution.
|
Django - Privatizing Code - Which files are served to a user?
| 17,893,390 | 3 | 0 | 43 | 0 |
python,django
|
Django only serves the responses that you explicitly create and return from your views. There is no general ability to request files from it.
Make sure your source code isn't in a directory that your web server is configured to serve from, and make sure your settings.py value for DEBUG is False, and you should be fine. Oh, and just in case - don't try to use the Django development server in production.
| 0 | 0 | 0 | 0 |
2013-07-27T01:23:00.000
| 2 | 1.2 | true | 17,893,360 | 0 | 0 | 1 | 2 |
I am using Django to develop an API using an algorithm I wrote.
When someone requests a url, my urls.py calls a function in views.py which serves
page that returns a JSON string.
If my algorithm is in my views.py file, or in another file on my server, would it be possible for a user to view the contents of this file, and then see my algorithm?
In other words, when using Django, which files will never be served to a user, and which files will be?
Is there any way I can stop someone from viewing my algorithm if it's in a .py file? Other than Chmodding the file or encrypting the code?
Thank you for your time.
|
Django - Privatizing Code - Which files are served to a user?
| 17,893,392 | 1 | 0 | 43 | 0 |
python,django
|
As long as nobody has shell access to your server, people will never see more than the actual HTML output of your page. .py files are not shown to the user that has requested an url in the browser.
| 0 | 0 | 0 | 0 |
2013-07-27T01:23:00.000
| 2 | 0.099668 | false | 17,893,360 | 0 | 0 | 1 | 2 |
I am using Django to develop an API using an algorithm I wrote.
When someone requests a url, my urls.py calls a function in views.py which serves
page that returns a JSON string.
If my algorithm is in my views.py file, or in another file on my server, would it be possible for a user to view the contents of this file, and then see my algorithm?
In other words, when using Django, which files will never be served to a user, and which files will be?
Is there any way I can stop someone from viewing my algorithm if it's in a .py file? Other than Chmodding the file or encrypting the code?
Thank you for your time.
|
How to structure Python code to support multiple releases of MY project (i.e. not multiple versions of Python)
| 17,898,532 | 0 | 0 | 133 | 0 |
python,subprocess
|
There are a couple of tricks - they basically reply on discipline on the development teams part:
Publish an API and stick to it all V2 functions of the same name must accept the same parameters and return compatible results when so called.
Have a general interface say fred that just wraps your V1 functions
Make use of named and defaulted parameters rather than positional parameters, then if your version 2 code supports some additional parameters but the defaults result in the version 1 behaviour you will be golden.
Use Namespaces
If you define your functions in the fn(*arg, **agv) format you can have a wrapper in your general interface that works out if the V1 or V2 functions are intended in a given call.
You can have an optional parameter ifversion=1 in all your functions that might be ambiguous and use it when you specifically need the version 2 stuff.
There is another really simple method which is for the V2 front end to connect to a different port or use a specific flag in the html requrest.
| 0 | 0 | 0 | 0 |
2013-07-27T13:24:00.000
| 3 | 0 | false | 17,898,306 | 1 | 0 | 1 | 2 |
I'm working on the back end of a web-based system. My code will receive calls from our web site and perform the actions requested by the user. We would like to support multiple versions of our front end simultaneously. So, for example, I might receive a request from V1 of our front end or from V2 of it. I need to respond to either of these calls.
As you might expect, a lot of my code will be the same across versions. For example, my function *get_list_access_params()* will probably appear in both V1 and V2 (although there may be some changes to the code in it). My listener should grab the request, figure out which version of our system the call came from and, then, call the right version of *get_list_access_params()*.
My hope is to not have to duplicate and rename the function as v1_get... and v2_get... but, rather, to duplicate the function in two code files, a v1 file and a v2 file.
This must be a common need but I can't figure out where to look for the answer. Does anyone have a quick answer or can you direct me to a simple place to find it (I am a Python novice, BTW)? Thank you!
|
How to structure Python code to support multiple releases of MY project (i.e. not multiple versions of Python)
| 17,898,413 | 0 | 0 | 133 | 0 |
python,subprocess
|
Your subprocess offers an API to the web sites.
The trick is to make it so that API v2 of the subprocess code can handle calls from both v1 and v2 web sites. This is called backward compatibility.
Also, it's nice if the v1 web site is not too picky about the data it receives and can for instance handle a v2 answer from the subprocess that has more information than it used to have in v1. This is called forward compatibility. Json and xml are good ways to achieve it, since you can add properties and attributes at will without harming the parsing of the old properties.
So the solution, I think, does not lie in a python trick, but in careful design of the API of your subprocess such that the API will not break as the subprocess's functionality increases.
| 0 | 0 | 0 | 0 |
2013-07-27T13:24:00.000
| 3 | 0 | false | 17,898,306 | 1 | 0 | 1 | 2 |
I'm working on the back end of a web-based system. My code will receive calls from our web site and perform the actions requested by the user. We would like to support multiple versions of our front end simultaneously. So, for example, I might receive a request from V1 of our front end or from V2 of it. I need to respond to either of these calls.
As you might expect, a lot of my code will be the same across versions. For example, my function *get_list_access_params()* will probably appear in both V1 and V2 (although there may be some changes to the code in it). My listener should grab the request, figure out which version of our system the call came from and, then, call the right version of *get_list_access_params()*.
My hope is to not have to duplicate and rename the function as v1_get... and v2_get... but, rather, to duplicate the function in two code files, a v1 file and a v2 file.
This must be a common need but I can't figure out where to look for the answer. Does anyone have a quick answer or can you direct me to a simple place to find it (I am a Python novice, BTW)? Thank you!
|
Pyramid: Tween or WSGI middleware for custom logger and external entitlement system?
| 17,915,346 | 2 | 3 | 792 | 0 |
python,pyramid,middleware,tween
|
Everything is better as WSGI middleware unless you need framework-specific details. Especially if you're smart and use the webob decorators to turn the complex WSGI protocol into simple request/response objects. For example when integrating with permissions I'm not even sure a tween makes sense. From within your groupfinder you can just connect to your entitlement system. For logging there are a lot of examples of both WSGI (paste's translogger) and tween (pyramid_exclog, pyramid_debugtoolbar) loggers that you can pull ideas from.
| 0 | 0 | 0 | 0 |
2013-07-27T20:38:00.000
| 2 | 1.2 | true | 17,902,229 | 0 | 0 | 1 | 1 |
I would like to get a clear understanding of what would be the most pythonic and cleaner way to implement:
a custom logger.
a piece of code which connects via REST to a third-party entitlement system to be combined with the internal Pyramid ACLs and permission system.
Should I rather write a WSGI middleware which gets the app as parameter or a pure Pyramid Tween for either one or both my requirements?
Also, which of wsgi middleware or tween is the most compliant with apache + mod_wsgi?
Thanks
|
GAE Blobstore file-like API deprecation timeline (py 2.7 runtime)
| 17,959,762 | 1 | 5 | 677 | 0 |
google-app-engine,python-2.7
|
Official response from Chris Ramsdale, Product Manager, Google App Engine:
while there's currently no defined date for decommissioning this API, we are committed to supporting it throughout the remainder of the year (2013). please don't hesitate to reach out to me directly [redacted], if you have further questions (this thread is fine as well).
| 0 | 1 | 0 | 0 |
2013-07-27T22:20:00.000
| 1 | 1.2 | true | 17,903,025 | 0 | 0 | 1 | 1 |
This is a question for the App Engine team.
Last week we realized that the App Engine team had marked the file-like API for writing and reading to the blobstore as being deprecated and likely to be removed in the future. We have quite a bit of infrastructure relying on that API that now we need to port to the alternative they suggest (Google Cloud Storage) and this is not a trivial effort (especially considering our current backlog). So the question is: how soon will this file-like API be unavailable? It's fairly important for us to know as depending on the answer, we might shuffle our backlog to prioritize the porting of using the Blobstore to GCS.
Thanks.
|
Run both php and python at the same time on google app engine
| 17,911,235 | 1 | 0 | 431 | 0 |
php,python,google-app-engine,runtime
|
Quite simply, no. You'll have to use separate modules, or pick one language and use it for both of the things you describe.
| 0 | 1 | 0 | 1 |
2013-07-28T15:15:00.000
| 3 | 0.066568 | false | 17,909,688 | 0 | 0 | 1 | 3 |
I heard that this was possible using the new modules features for the google app engine, but this will require two different modules, which basically is like two different apps. I would like to be able to run my python and php in the same application. Im getting some results via python and I want to parse them using php to get an API that is able to communicate with my other webapplications online. it will be like a proxy between my python scripts and webapplication.
Is there any way to achieve this?
|
Run both php and python at the same time on google app engine
| 17,911,325 | 0 | 0 | 431 | 0 |
php,python,google-app-engine,runtime
|
Segregate your applications in different modules and communicate between the two using the GAE Data Store or Memcache.
Your applications can signal each other using a GET request with the name of the Memcache key or the url safe data store key.
| 0 | 1 | 0 | 1 |
2013-07-28T15:15:00.000
| 3 | 0 | false | 17,909,688 | 0 | 0 | 1 | 3 |
I heard that this was possible using the new modules features for the google app engine, but this will require two different modules, which basically is like two different apps. I would like to be able to run my python and php in the same application. Im getting some results via python and I want to parse them using php to get an API that is able to communicate with my other webapplications online. it will be like a proxy between my python scripts and webapplication.
Is there any way to achieve this?
|
Run both php and python at the same time on google app engine
| 17,914,860 | 0 | 0 | 431 | 0 |
php,python,google-app-engine,runtime
|
You can achieve the proxy pattern by simply making http requests from one module to the other, using the URLFetch service.
| 0 | 1 | 0 | 1 |
2013-07-28T15:15:00.000
| 3 | 0 | false | 17,909,688 | 0 | 0 | 1 | 3 |
I heard that this was possible using the new modules features for the google app engine, but this will require two different modules, which basically is like two different apps. I would like to be able to run my python and php in the same application. Im getting some results via python and I want to parse them using php to get an API that is able to communicate with my other webapplications online. it will be like a proxy between my python scripts and webapplication.
Is there any way to achieve this?
|
Running GAE remote_api_shell.py in a iPython notebook web interface
| 17,931,783 | 0 | 0 | 259 | 0 |
google-app-engine,ipython,ipython-notebook
|
iPython Notebook has profile directories in ~/.ipython, which have a startup directory for Python scripts that can be used to do the customization of sys.path and login credentials as remote_api_shell.py does.
| 0 | 1 | 0 | 0 |
2013-07-28T20:46:00.000
| 1 | 1.2 | true | 17,912,720 | 0 | 0 | 1 | 1 |
I'd like to run modified remote_api_shell.py in an iPython notebook web interface, so that non-technical users with a basic grasp of Python could have read-only access to our production database.
Has anyone set something like this up, and what's the best way of going about it?
|
How to call a *.jsl script from python script
| 34,890,487 | 0 | 4 | 4,983 | 0 |
python-3.x,sas-jmp,jsl
|
Make sure jmp.exe is available in your system environment so that if you type "jmp.exe" in the command line, it would launch jmp. Then have your *.jsl ready.
use python procees to run this command "jmp.exe *.jsl" and that would open jmp and run the *.jsl script and then you can import whatever you generate from jmp back in to python.
| 0 | 0 | 0 | 0 |
2013-07-29T18:27:00.000
| 3 | 0 | false | 17,931,476 | 0 | 0 | 1 | 1 |
I have a python script running. I want to call *.jsl script in my running python script and want to make use of it's output in python. May I know how can I do that?
|
Copying files in the same Amazon S3 bucket
| 20,389,005 | 0 | 1 | 995 | 1 |
python,amazon-web-services,amazon-s3,boto,s3cmd
|
Since your source path contains your destination path, you may actually be copying things more than once -- first into the destination path, and then again when that destination path matches your source prefix. This would also explain why copying to a different bucket is faster than within the same bucket.
If you're using s3s3mirror, use the -v option and you'll see exactly what's getting copied. Does it show the same key being copied multiple times?
| 0 | 0 | 0 | 0 |
2013-07-29T18:32:00.000
| 1 | 0 | false | 17,931,579 | 0 | 0 | 1 | 1 |
I am trying to copy the entire /contentstore/ folder on a bucket to a timestamped version. Basically /contenstore/ would be copied to /contentstore/20130729/.
My entire script uses s3s3mirror first to clone my production S3 bucket to a backup. I then want to rename the backup to a timestamped copy so that I can keep multiple versions of the same.
I have a working version of this using s3cmd but it seems to take an abnormally long time. The s3s3mirror part between the two buckets is done within minutes, possibly because it is a refresh on existing folder. But even in the case of a clean s3s3mirror (no existing contentstore on backup) it take around 20 minutes.
On the other hand copying the conentstore to a timestamped copy on the backup bucket takes over an hour and 10 minutes.
Am I doing something incorrectly? Should the copy of data on the same bucket take longer than a full clone between two different buckets?
Any ideas would be appreciated.
P.S: The command I am running is s3cmd --recursive cp backupBucket/contentStore/ backupBucket/20130729/
|
Using guardian's assign_perm in a south migration
| 27,130,661 | 0 | 1 | 193 | 0 |
python,django-south,django-guardian
|
I used get_user_model() instead of orm['auth.User']
| 0 | 0 | 0 | 0 |
2013-07-29T19:33:00.000
| 1 | 0 | false | 17,932,649 | 0 | 0 | 1 | 1 |
I can't get django-guardian assign_perm to work in a south datamigration ... the reason it is not working seems to be because guardian is not using the frozen ORM. How can I get other apps in general and django-guardian specifically to use frozen models.
|
Update a MySQL table from an HTML table with thousands of rows
| 17,940,205 | 0 | 1 | 509 | 1 |
python,mysql,beautifulsoup,mysql-python
|
My Suggestion is instead of updating values row by row try to use Bulk Insert in temporary table and then move the data into an actual table based on some timing key. If you have key column that will be good for reading the recent rows as you added.
| 0 | 0 | 0 | 0 |
2013-07-30T06:33:00.000
| 2 | 0 | false | 17,939,824 | 0 | 0 | 1 | 1 |
I have an html file on network which updates almost every minute with new rows in a table. At any point, the file contains close to 15000 rows I want to create a MySQL table with all data in the table, and then some more that I compute from the available data.
The said HTML table contains, say rows from the last 3 days. I want to store all of them in my mysql table, and update the table every hour or so (can this be done via a cron?)
For connecting to the DB, I'm using MySQLdb which works fine. However, I'm not sure what are the best practices to do so. I can scrape the data using bs4, connect to table using MySQLdb. But how should I update the table? What logic should I use to scrape the page that uses the least resources?
I am not fetching any results, just scraping and writing.
Any pointers, please?
|
Implementing social login in Flask
| 28,427,169 | 1 | 5 | 2,924 | 0 |
python,flask,flask-login,flask-security
|
Mark Hildreth is correct.
flask-social allows you to log in via a form (username/password) or via social.
So you can use it in conjunction with flask-security, flask-login, or whatever password-based authentication you want. I have used flask-social in conjunction with flask-security and can confirm they work quite well together.
flask-social links each User object to zero or more additional social accounts, which are stored in a separate table/datastore. Thus, it does not replace the existing password infrastructure...it just augments the User model and adds additional social methods to also allow for the user to log in alternatively via social accounts.
| 0 | 0 | 0 | 0 |
2013-07-30T15:59:00.000
| 1 | 0.197375 | false | 17,951,872 | 0 | 0 | 1 | 1 |
Looking to implement social authentication in our application with LinkedIn, Google, Facebook. I'm currently using flask-security to help manage users/roles in our application. I'm looking for some guidance on best practices with Flask/Flask-Security and Social Authentication.
I've seen the flask-social plugin, but I'd like to have the option of local form-based login, too.
So far, I'm planning on writing a new login view implementation for flask-security that can determine whether I'm using a social site (via passing a query parameter when user clicks on "login with XYZ") for the login. After social authentication occurs, I was planning on running the regular flask-security login to set all the appropriate session tokens and user and roles so the @login_required decorator will continue to work.
I didn't really see any hooks for overriding the login view function in flask-security, so I'm planning on either 1) copying the existing implementation into my own app or 2) calling flask_security_views::login.
However, I'm wondering if there's some of this that's already been implemented somewhere, or a better start. It seems like I'm really going to be cutting up a lot of existing code.
Thanks
|
I have a static website built using HTML, CSS and Javascript. How do I integrate this with a SQLite3 database accessed with the Python API?
| 18,099,967 | 1 | 5 | 1,713 | 1 |
python,sqlite,static-site
|
It looks like your needs has changed and you are going into direction where static web site is not sufficient any more.
Firstly, I would pick appropriate Python framework for your needs. if static website was sufficient until recently Django can be perfect for you.
Next I would suggest describing your DB schema for ORM used in chosen framework. I see no point in querying your DB using SQL until you would have a specific reason.
And finally, I would start using static content of your website as templates, replacing places where dynamic data is required. Django internal template language can be easily used that way. If not, Jinja2 also could be good.
My advise is base on many assumptions, as your question is quite open and undefined.
Anyway, I think it would be the best way to start transition period from static to dynamic.
| 0 | 0 | 0 | 0 |
2013-07-30T17:29:00.000
| 3 | 0.066568 | false | 17,953,552 | 0 | 0 | 1 | 1 |
Title question says it all. I was trying to figure out how I could go about integrating the database created by sqlite3 and communicate with it through Python from my website.
If any further information is required about the development environment, please let me know.
|
Push information from Django to iOS locally
| 17,957,913 | 0 | 0 | 114 | 0 |
python,ios,django,sockets,push
|
Once your app is no longer in the foreground, the only way to communicate with it at all is via push notification.
If the app is open, you could create some kind of listener socket, register it with your Django server, and have the server talk to the socket. Otherwise your best bet would be to just poll the server every minute or two.
| 0 | 0 | 0 | 0 |
2013-07-30T21:20:00.000
| 1 | 0 | false | 17,957,619 | 0 | 0 | 1 | 1 |
Is it possible to push information from Django to an iOS application over a local intranet? Whenever there is a specific POST request to the Django-server, I would like to either push out some information to the devices, or just send a signal to the devices, asking them to pull from the API.
This problem would normally be solved using push notifications, but the fact is that all the devices including the server are only connected to a local network without internet connection.
I have been thinking of using some kind of a socket, but haven't been able to find something that suits this purpose, and writing my own would be a lot of work and probably not worth it.
Does anyone know of any frameworks that can help, or have another approach to the problem?
|
Django-CMS Type Error "a float is required"
| 18,367,549 | 0 | 0 | 397 | 0 |
python,django,deployment,django-cms,bluehost
|
As I wondered, the problem was that I was accessing the site using my temporary link from BlueHost, which the function throwing the error could not handle.
When my clients finally pointed their domain name at the server this problem and a few others (CSS inconsistencies in the Django admin, trouble with .htaccess) disappeared. Everything is up now and working fine.
| 0 | 0 | 0 | 0 |
2013-07-31T01:42:00.000
| 1 | 1.2 | true | 17,960,261 | 0 | 0 | 1 | 1 |
I'm deploying my first Django app on a BlueHost shared server. It is a simple site powered by Django-CMS, and portions of it are working, however there are some deal-breaking quirks.
A main recurring one reads TypeError, a float is required. The exception location each time is .../python/lib/python2.7/site-packages/django/core/urlresolvers.py in _reverse_with_prefix, line 391. For example, I run into it when trying to load a page which includes {% cms_toolbar %} in the template, pressing "save and continue editing" when creating a page, or trying to delete a page through the admin interface.
I don't know if this is related, but nothing happens when I select a plugin from the "Available Plugins" drop-down while editing a page and press "Add Plugin".
Has anyone had any experience with this error, or have any ideas how to fix it?
|
Serve static files through a custom handler or register in app.yaml?
| 17,979,219 | 0 | 0 | 105 | 0 |
python,google-app-engine,webapp2
|
Use the static handler:
You don't need to startup an instance to serve your file. This generally means it'll be served quicker, and you save on CPU hours.
You don't have to worry edge caching.
The cons might be that the files are static, and it might require more manual intervention with your framework.
| 0 | 0 | 0 | 0 |
2013-07-31T09:03:00.000
| 1 | 1.2 | true | 17,966,015 | 0 | 0 | 1 | 1 |
In a project I'm developing I'm using several Python projects as dependencies. These projects each come with static files (JavaScript, images, etc.) and a set of handlers (with default URLs). To register the URLs for the handlers I add them to the routes in the WSGI application. The static files however need to be registered in the app.yaml. This is something I would like to avoid so it becomes a breeze to register both handler URLs and static files.
I thought about implementing a request handler that takes a file location and serves it with HTTP cache (like I think the default static handlers do).
I've discussed the idea with a colleague and he thought this was a bad idea. He told me that when registering the static files in the app.yaml the files are served in a more optimized way (possibly without Python).
Before I go and implement a static handler I'd like to hear what would be the pros/cons of both methods and if the static handler idea is a good idea.
In current projects we let Buildout generate the app.yaml from a template. The static files are added there. The (obvious) downside is that this process is error prone (if done automatically) or redundant (if done manually).
|
Putting something on your system path
| 17,968,753 | 1 | 1 | 77 | 0 |
python,django,linux,ubuntu
|
System path is an system environment variable that contains the path for some folders where the os will search for applications, scripts, etc.
In windows django-admin.py is in C:\Python\scripts, so if you have set the PYTHONPATH environment variable and added all the required python folder in that variable like C:\Python;C:\Python\Lib;C:\Python\scripts;C:\Python\Lib\site-packages, the os will automatically find django-admin.py when you will type the command django-admin.py startproject myproj on commandline.
same with linux, the django-admin.py is in /usr/bin/django-admin.py if you install django for the default python installation.
so, one way could be if you create a alias for that script so that you can run it from where ever you want.
i am using centos and what i did is i edited the /etc/bashrc and added
alias djangoadmin='/usr/bin/django-admin.py' and it works for me very well.
| 0 | 0 | 0 | 0 |
2013-07-31T10:54:00.000
| 3 | 0.066568 | false | 17,968,422 | 0 | 0 | 1 | 2 |
I am trying a python, django tutorial. It says type django-admin.py however I get 'command not found' with this.
Someone told me that the problem could be that django is not in your system path, what does that mean?
I am using ubuntu.
|
Putting something on your system path
| 17,972,309 | 0 | 1 | 77 | 0 |
python,django,linux,ubuntu
|
If you installed Django from the Ubuntu repositories via apt-get or synaptic, the script will be simply django-admin (without the .py).
| 0 | 0 | 0 | 0 |
2013-07-31T10:54:00.000
| 3 | 0 | false | 17,968,422 | 0 | 0 | 1 | 2 |
I am trying a python, django tutorial. It says type django-admin.py however I get 'command not found' with this.
Someone told me that the problem could be that django is not in your system path, what does that mean?
I am using ubuntu.
|
Reading the app engine logs.db file?
| 18,027,540 | 0 | 0 | 67 | 0 |
python,google-app-engine
|
It's an sqlite file, can just read it with sqlite3 module.
| 0 | 1 | 0 | 0 |
2013-07-31T23:55:00.000
| 1 | 1.2 | true | 17,982,992 | 0 | 0 | 1 | 1 |
I want to read the logs.db file with an external script, but I don't know what format it's in (it's binary) to know what to read it with. It's a massive rabbit hole to try to figure out the log_service module, and I'm hoping I can shortcut that and just open it into readable text some other way.
Any ideas?
|
What is the best way to track / record the current programming project u work on
| 18,004,681 | 0 | 3 | 278 | 0 |
python,coding-style,project-management,jira,issue-tracking
|
Every time you revisit code, make a list of the information you are not finding. Then the next time you create code, make sure that information is present. It can be in comments, Wiki, bugs or even text notes in a separate file. Make the notes useful for other people, so private notebooks aren't a good idea except for personal notes.
| 0 | 0 | 0 | 1 |
2013-08-01T03:42:00.000
| 2 | 0 | false | 17,984,890 | 0 | 0 | 1 | 1 |
I have been in this problem for long time and i want to know how its done in real / big companies project.
Suppose i have the project to build a website. now i divide the project into sub tasks and do it.
But u know that suppose i have task1 in hand like export the page to pdf. Now i spend 3 days to do that , came accross various problems , many stack overflow questions and in the end i solve it.
Now 4 months after someone told me that there is some error in the code.
Now by that i comepletely forgot about(60%) how i did it and why i do this way. I document the code but i can't write the whole story of that in the code.
Then i have to spend much time on code to find what was the problem so that i added this line etc.
I want to know that is there any way that i can log steps in completeing the project.
So that i can see how i end up with code , what erros i got , what questions i asked on So and etc.
How people do it in real time. Which software to use.
I know in our project management softaware called JIRA we have tasks but that does not cover what steps i took to solve that tasks.
what is the besy way so that when i look backt at my 2 year old project , i know how i solve particular task
|
Django admin tools new version model changes
| 18,301,020 | 0 | 2 | 500 | 0 |
python,django,django-admin-tools
|
After upgrading django admin tools I faced the same problem and ended up dropping tables admin_tools_dashboard_preferences and admin_tools_menu_bookmark and recreating them using python manage.py syncdb. Obviously, it will erase all custom parameters you may set before so make sure you made a backup.
| 0 | 0 | 0 | 0 |
2013-08-01T10:14:00.000
| 2 | 0 | false | 17,991,190 | 0 | 0 | 1 | 1 |
I upgraded Django admin_tools to the latest version 0.5 . And I'm using Django 1.3
Now I am getting this error when I go to admin pages:
OperationalError: (1054, "Unknown column 'admin_tools_dashboard_preferences.dashboard_id' in 'field list'")
There are no instructions mentioned in the documentation for fixing this. What ALTER TABLE should I fire without letting go of the old data?
PS: I do not use South.
|
How to abort a workflow transition in Plone
| 18,020,552 | 3 | 4 | 298 | 0 |
python,workflow,plone
|
The recommended way is to set a guard instead.
The guard expression should be able to look up a view to facilitate more complex guard code, but when a guard returns False the transition isn't even listed as available.
| 0 | 0 | 0 | 0 |
2013-08-01T18:39:00.000
| 2 | 0.291313 | false | 18,001,984 | 0 | 0 | 1 | 1 |
I am working on a complex validation in a dexterity content type which should check the dependencies across several fields at the workflow transition time - I want it to work in the SimplePublicationWorkflow being triggered when the content is sent from "private" to "pending".
I've registered an event listener for IBeforeEvent and hooked it up - but nothing done there short of raising an exception can stop the transition from happening. (and if you raise an exception there, it goes uncaught and the user sees an error page instead of a custom message).
So, what is the recommended way to validate a transition in modern Plone? I've came across documentation suggesting adding External methods to be called on the Guard expression of the transition - but I would not like to use external methods, and if possible, I'd like to keep the default workflow. Creating a custom one is an option provided a clean way to do the check.
|
Python bottle vs uwsgi/bottle vs nginx/uwsgi/bottle
| 49,163,067 | 2 | 11 | 7,565 | 0 |
python,nginx,uwsgi,bottle
|
I also suggest you look at running bottle via gevent.pywsgi server. It's awesome, super simple to setup, asynchronous, and very fast.
Plus bottle has an adapter built for it already, so even easier.
I love bottle, and this concept that it is not meant for large projects is ridiculous. It's one of the most efficient and well written frameworks, and can be easily molded without a lot of hand wringing.
| 0 | 1 | 0 | 1 |
2013-08-01T22:53:00.000
| 3 | 0.132549 | false | 18,006,014 | 0 | 0 | 1 | 2 |
I am developing a Python based application (HTTP -- REST or jsonrpc interface) that will be used in a production automated testing environment. This will connect to a Java client that runs all the test scripts. I.e., no need for human access (except for testing the app itself).
We hope to deploy this on Raspberry Pi's, so I want it to be relatively fast and have a small footprint. It probably won't get an enormous number of requests (at max load, maybe a few per second), but it should be able to run and remain stable over a long time period.
I've settled on Bottle as a framework due to its simplicity (one file). This was a tossup vs Flask. Anybody who thinks Flask might be better, let me know why.
I have been a bit unsure about the stability of Bottle's built-in HTTP server, so I'm evaluating these three options:
Use Bottle only -- As http server + App
Use Bottle on top of uwsgi -- Use uwsgi as the HTTP server
Use Bottle with nginx/uwsgi
Questions:
If I am not doing anything but Python/uwsgi, is there any reason to add nginx to the mix?
Would the uwsgi/bottle (or Flask) combination be considered production-ready?
Is it likely that I will gain anything by using a separate HTTP server from Bottle's built-in one?
|
Python bottle vs uwsgi/bottle vs nginx/uwsgi/bottle
| 18,006,120 | 15 | 11 | 7,565 | 0 |
python,nginx,uwsgi,bottle
|
Flask vs Bottle comes down to a couple of things for me.
How simple is the app. If it is very simple, then bottle is my choice. If not, then I got with Flask. The fact that bottle is a single file makes it incredibly simple to deploy with by just including the file in our source. But the fact that bottle is a single file should be a pretty good indication that it does not implement the full wsgi spec and all of its edge cases.
What does the app do. If it is going to have to render anything other than Python->JSON then I go with Flask for its built in support of Jinja2. If I need to do authentication and/or authorization then Flask has some pretty good extensions already for handling those requirements. If I need to do caching, again, Flask-Cache exists and does a pretty good job with minimal setup. I am not entirely sure what is available for bottle extension-wise, so that may still be worth a look.
The problem with using bottle's built in server is that it will be single process / single thread which means you can only handle processing one request at a time.
To deal with that limitation you can do any of the following in no particular order.
Eventlet's wsgi wrapping the bottle.app (single threaded, non-blocking I/O, single process)
uwsgi or gunicorn (the latter being simpler) which is most ofter set up as single threaded, multi-process (workers)
nginx in front of uwsgi.
3 is most important if you have static assets you want to serve up as you can serve those with nginx directly.
2 is really easy to get going (esp. gunicorn) - though I use uwsgi most of the time because it has more configurability to handle some things that I want.
1 is really simple and performs well... plus there is no external configuration or command line flags to remember.
| 0 | 1 | 0 | 1 |
2013-08-01T22:53:00.000
| 3 | 1.2 | true | 18,006,014 | 0 | 0 | 1 | 2 |
I am developing a Python based application (HTTP -- REST or jsonrpc interface) that will be used in a production automated testing environment. This will connect to a Java client that runs all the test scripts. I.e., no need for human access (except for testing the app itself).
We hope to deploy this on Raspberry Pi's, so I want it to be relatively fast and have a small footprint. It probably won't get an enormous number of requests (at max load, maybe a few per second), but it should be able to run and remain stable over a long time period.
I've settled on Bottle as a framework due to its simplicity (one file). This was a tossup vs Flask. Anybody who thinks Flask might be better, let me know why.
I have been a bit unsure about the stability of Bottle's built-in HTTP server, so I'm evaluating these three options:
Use Bottle only -- As http server + App
Use Bottle on top of uwsgi -- Use uwsgi as the HTTP server
Use Bottle with nginx/uwsgi
Questions:
If I am not doing anything but Python/uwsgi, is there any reason to add nginx to the mix?
Would the uwsgi/bottle (or Flask) combination be considered production-ready?
Is it likely that I will gain anything by using a separate HTTP server from Bottle's built-in one?
|
best practice for graph-like entities on appengine ndb
| 18,035,092 | 1 | 1 | 478 | 1 |
python,google-app-engine,app-engine-ndb,graph-databases
|
There's two ways to implement one-to-many relationships in App Engine.
Inside entity A, store a list of keys to entities B1, B2, B3. In th old DB, you'd use a ListProperty of db.Key. In ndb you'd use a KeyProperty with repeated = True.
Inside entity B1, B2, B3, store a KeyProperty to entity A.
If you use 1:
When you have Entity A, you can fetch B1, B2, B3 by id. This can be potentially more consistent than the results of a query.
It could be slightly less expensive since you save 1 read operation over a query (assuming you don't count the cost of fetching entity A). Writing B instances is slightly cheaper since it's one less index to update.
You're limited in the number of B instances you can store by the maximum entity size and number of indexed properties on A. This makes sense for things like conference tracks since there's generally a limited number of tracks that doesn't go into the thousands.
If you need to sort the order of B1, B2, B3 arbitrarily, it's easier to store them in order in a list than to sort them using some sorted indexed property.
If you use 2:
You only need entity A's Key in order to query for B1, B2, B3. You don't actually need to fetch entity A to get the list.
You can have pretty much unlimited # of B entities.
| 0 | 1 | 0 | 0 |
2013-08-02T12:42:00.000
| 2 | 0.099668 | false | 18,017,150 | 0 | 0 | 1 | 1 |
I'm designing a g+ application for a big international brand. the entities I need to create are pretty much in form of a graph, hence a lot of many-to-many relations (arcs) connecting nodes that can be traversed in both directions. I'm reading all the readable docs online, but I haven't found anything so far specific to ndb design best practices and guidelines. unfortunately I am under nda, and cannot reveal details of the app, but it can match almost one to one the context of scientific conferences with proceedings, authors, papers and topics.
below the list of entities envisioned so far (with context shifted to match the topics mentioned):
organization (e.g. acm)
conference (e.g. acm multimedia)
conference issue (e.g. acm multimedia 13)
conference track (e.g. nosql, machine learning, computer vision, etc.)
author (e.g. myself)
paper (e.g. "designing graph like db for ndb")
as you can see, I can visit and traverse the graph through any direction (or facet, from a frontend point of view):
author with co-authors
author to conference tracks
conference tracks to papers
...
and so on, you fill the list.
I want to make it straight and solid because it will launch with a lot of p.r. and will need to scale consistently overtime, both in content and number of users. I would like to code it from scratch hence designing my own models, restful api to read/write this data, avoiding non-rel django and keeping the presentation layer to a minimum template mechanism. I need to check with the company where I work, but we might be able to release part of the code with a decent open source license (ideally, a restful service for ndb models).
if anyone could point me towards the right direction, that would be awesome.
thanks!
thomas
[edit: corrected typo related to many-to-many relations]
|
GAE, Python: How to define db object classes in only one place?
| 18,020,650 | 2 | 2 | 65 | 0 |
python,class,google-app-engine
|
Make a seperate .py file called something like classes and variables, place all classes you use in your code in that file and call it upon startup for both files.
| 0 | 0 | 0 | 0 |
2013-08-02T15:20:00.000
| 2 | 0.197375 | false | 18,020,557 | 0 | 0 | 1 | 1 |
I have a main.py which contains class definitions for objects that are fetched from db and displayed.
I also have a scrape.py that fetches these same sorts of objects from the web, and stores them to the db.
How do I avoid having to have class definitions for these objects in both main.py and scrape.py?
|
Python 2.7 - Codenvy - Debugging issues
| 23,685,697 | 1 | 2 | 427 | 0 |
google-app-engine,python-2.7,codenvy
|
I discovered that if you go to the Google App Developper Console, there is a menu on the left. Click on App Engine, then click on Logs. There you can see the internal server error (error 500) log, which pretty much tell you what went wrong.
| 0 | 1 | 0 | 0 |
2013-08-03T02:58:00.000
| 2 | 0.099668 | false | 18,028,841 | 0 | 0 | 1 | 1 |
I'm working with Codenvy writing a Google Appengine app, and I have found it to be INSANELY difficult to debug. If there's a syntax error I have to find it manually as the web page that loads when testing give me and error:500. Also, I often want to print but Codenvy doesn't support printing for python (that or I don't understand the correct method). Has anyone else experienced this and able to help? Perhaps developing in the cloud isn't as easy as I was hoping...
|
Django admin radio-button for one-to-one relationship
| 18,045,653 | 0 | 1 | 419 | 0 |
python,django,one-to-one,modeladmin
|
Add OneToOneField for Photo in House model (you will need to reference it as "YOUR_APP.Photo" to avoid circular references), provide ModelAdmin with custom form, and in that form's constructor filter queryset for that field to display only photos for current house.
Different approach is to add highlighted flag in Photo model and ensure on save that only one photo is highlighted for one house.
| 0 | 0 | 0 | 0 |
2013-08-04T13:37:00.000
| 1 | 0 | false | 18,043,529 | 0 | 0 | 1 | 1 |
I have 2 model classes in my django app:
1: House (name, location, id...)
2: Photo (description, id, house -foreign key-).
In the admin interface, the photo is displayed as inline for the house form, but now, I want the user to be able to choose ONE picture as highlighted for that house.
My question is: there's someway to add a radiobutton so the user is only able to choose one picture?
Could you help me to achieve this, please?
Thanks!
|
how to set name of a field dynamically in openerp?
| 18,071,459 | 2 | 0 | 939 | 0 |
python,eclipse,openerp
|
Do you mean you want a dynamic field on the form/tree view or in the model?
If it is in the view then you override fields_view_get, call super and then process the returned XML for the form type you want adding in the field or manipulating the XML. ElementTree is your friend here.
If you are talking about having a dynamic database field, I don't think you can and OpenERP creates a registry for each database when that database is first accessed and this process performs database refactoring at that time. The registry contains the singleton model instances you get with self.pool.get...
To achieve this you will need to create some kind of generic field like field1 and then in fields_view_get change the string attribute to give it a dynamic label.
Actually, a plan C occurs to me. You could create a properties type of table, use a functional field to read the value for the current user and override fields_view_get to do the form.
| 0 | 0 | 0 | 0 |
2013-08-05T04:50:00.000
| 2 | 0.197375 | false | 18,050,770 | 0 | 0 | 1 | 2 |
Hi I am working on an openerp module . I want to make a field dynamically . I want to take a name of a field from user and then create a field to it . How this can be done ? Can I do it with fields.function to return name, char type ? Plz help
|
how to set name of a field dynamically in openerp?
| 18,071,982 | 0 | 0 | 939 | 0 |
python,eclipse,openerp
|
You can create Fields Dynamically by the help of class self.pool.get('ir.model.fields')
Use Create Function.
| 0 | 0 | 0 | 0 |
2013-08-05T04:50:00.000
| 2 | 0 | false | 18,050,770 | 0 | 0 | 1 | 2 |
Hi I am working on an openerp module . I want to make a field dynamically . I want to take a name of a field from user and then create a field to it . How this can be done ? Can I do it with fields.function to return name, char type ? Plz help
|
Django strange behavior: manage.py commands do not end
| 18,085,375 | 1 | 1 | 1,139 | 0 |
python,django,django-manage.py
|
Some dependency might be starting a thread. Django will wait for all threads to finish when autoreloading on code changes, or executing a management command. Inspect all dependencies to identify which one might be causing this problem.
| 0 | 0 | 0 | 0 |
2013-08-05T07:16:00.000
| 1 | 1.2 | true | 18,052,515 | 0 | 0 | 1 | 1 |
during the last days I am observing a very strange behavior in one of my django projects:
When I run some manage.py commands I see that although the commands are executed they do not end. For instance, if I try running syncdb:
c:\django> python manage.py syncdb
Syncing...
Creating tables ...
Creating table questions_category
Creating table questions_question
Creating table questions_answer
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)
At this time I should get a command input - but I don't! I have the same behavior with various other manage.py commands - they are running ok but they don't exit (for instance dumpdata or loadata - the data is dumped/loaded ok but when these finish I don't get the command prompt)! Has anybody observed the same behavior ? Is there a way to debug that ? I tried adding print statements at the end of my settings.py and I could see the output without problem.
Also, another problem I have which probably is related to the above is that the runserver_plus command no longer is able to find out code changes. So, when I run manage.py runserver_plus and change for instance my settings.py I see this:
* Detected change in 'C:\\progr\\py\\adeies\\adeies\\settings.py', reloading
And it stops there :( It doesnt reload the application ! Using the normal runserver reloads the application without problem however for obvious reasons I prefer using the runserver_plus command.
Do you have any ideas on how to debug this ?
Thanks !
|
How to prevent concurrent access to a resource such as a USB device?
| 18,089,913 | 1 | 1 | 1,351 | 0 |
python,concurrency,locking,semaphore,superglobals
|
Not exactly an answer to your question, but maybe another idea about how to tackle this with out using globals.
Why don't you write a small program for controlling your USB device. This script runs once (one instance) on your server and takes care of communicating with the device in the manner you need. It also takes care of concurrency.
Now communicate from your web application via pipes, sockets, whatever with this script, send commands to it and receive results from it.
| 0 | 0 | 0 | 0 |
2013-08-06T19:40:00.000
| 3 | 0.066568 | false | 18,089,022 | 0 | 0 | 1 | 1 |
I would like to be able to use a USB device from several applications (for instance I run a Flask web application), making sure only one uses it at a time.
In my case I am using a relay to open / close a door. The door takes about 20 seconds to open. During that time the relay should not be activated, because this would lock the door in the middle.
Thanks in advance!
|
Use of Mechanize Library with Python 2.7 and Django
| 27,438,161 | 0 | 1 | 277 | 0 |
django,mechanize,mechanize-python
|
As per comments, the answer is:
pip install mechanize
then just open a python interpreter and import mechanize to confirm.
That should be it, you can start using mechanize in your Django project.
| 0 | 0 | 0 | 0 |
2013-08-07T02:10:00.000
| 1 | 0 | false | 18,093,487 | 0 | 0 | 1 | 1 |
How do I use the mechanize library with Django?
I read online that I could put it in a directory (e.g. /lib/) and include as needed.
The problem is, the the source I had found didn't show how to use it from configuration to initial use. Unfortunately, I also looked high and low elsewhere on google with nothing to find. I also checked a book I have on django without any info..
Can anyone help me out?
I'm on a local install of django with python 2.7.
Thank you
|
Google App Engine shows notice to Upgrade Python to 2.7
| 18,107,791 | 3 | 0 | 427 | 0 |
python,google-app-engine
|
Here's the deal.
You have to migrate. They have announced the deprecation of the Python 2.5 runtime and will continue to support it in accordance with the Google App Engine Terms of Service. Here is the section you should concern yourself with...
7.3 Deprecation Policy.
Google will announce if we intend to discontinue or make backwards
incompatible changes to this API or Service. We will use commercially
reasonable efforts to continue to operate that Service without these
changes until the later of: (i) one year after the announcement or
(ii) April 20, 2015, unless (as Google determines in its reasonable
good faith judgment):
required by law or third party relationship (including if there is a
change in applicable law or relationship), or doing so could create a
security risk or substantial economic or material technical burden
(the above policy, the "Deprecation Policy"). This Deprecation Policy
doesn't apply to versions, features, and functionality labeled as
"experimental."
By my reckoning you have until some time in 2014 until they flat out drop support.
In the meantime...
Fork your application. Update the app.yaml to specify the Python27 runtime and for good measure turn thread safety on (you might save some money).
Test your application.
Move on with your life.
| 0 | 1 | 0 | 0 |
2013-08-07T04:31:00.000
| 1 | 1.2 | true | 18,094,718 | 0 | 0 | 1 | 1 |
I hope this posting is in the right location.
I am very new to Google App Engine, in fact its part of a iOS Application that I purchased from another developer, so bear with me please.
The iOS Application currently has 20,000 active users. There is no way I can break the system and their Application...so my question is, Should I Migrate to Pythion 2.7 since the message says 2.5 will soon be deprecated. Does that mean my users will drop if I dont migrate?
If I do Migrate, is there a chance that something might break and completely destroy the userbase and their use to the Application? What can go wrong if I Migrate?
This is the message at the top of my Dashboard on Google App Engine
A version of this application is using the Python 2.5 runtime, which is deprecated!
The application should be updated to the Python 2.7 runtime as soon as possible, which offers performance improvements and many new features. Learn how simple it is to migrate your application to Python 2.7.
Thanks everyone..
DC
|
Keep form fields from being editable
| 18,111,276 | 1 | 0 | 139 | 0 |
php,python,codeigniter
|
You could add a disable tag in your input if the user is not logged in. For example: <input type="text" name="lname" disabled>
| 0 | 0 | 0 | 0 |
2013-08-07T18:37:00.000
| 4 | 0.049958 | false | 18,111,203 | 0 | 0 | 1 | 1 |
I have a form that's pre-populated with values from a database. If a user is logged in and has sufficient permissions, the user can edit the fields. That all works well; however, if the user is not logged in, the fields should not be able to be changed. I have it so that any changes the bad user makes won't save to the database, but I'd like to make it so that the user can't even click into those fields.
Is there a way to conditionally allow form fields to be clickable?
|
Boto randomly connecting to different regions for S3 transfers
| 18,366,790 | 0 | 0 | 878 | 1 |
python,amazon-web-services,amazon-s3,boto
|
The problem ended up being an internal billing error at AWS and was not related to either S3 or Boto.
| 0 | 0 | 1 | 0 |
2013-08-07T20:42:00.000
| 2 | 0 | false | 18,113,426 | 0 | 0 | 1 | 1 |
I have several S3 buckets containing a total of 40 TB of data across 761 million objects. I undertook a project to copy these objects to EBS storage. To my knowledge, all buckets were created in us-east-1. I know for certain that all of the EC2 instances used for the export to EBS were within us-east-1.
The problem is that the AWS bill for last month included a pretty hefty charge for inter-regional data transfer. I'd like to know how this is possible?
The transfer used a pretty simple Python script with Boto to connect to S3 and download the contents of each object. I suspect that the fact that the bucket names were composed of uppercase letters might have been a contributing factor (I had to specify OrdinaryCallingFormat()), but I don't know this for sure.
|
I cannot import beautiful soup on python
| 29,046,403 | 3 | 8 | 29,930 | 0 |
python,beautifulsoup,python-import
|
Make sure you give 'B' and 'S' as capital while typing 'BeautifulSoup'
| 0 | 0 | 0 | 0 |
2013-08-08T08:50:00.000
| 3 | 0.197375 | false | 18,121,715 | 0 | 0 | 1 | 2 |
I installed Beautiful Soup library, and it seems to be well set up as there is the bs4 folder in C:\Python33\Lib\site-packages.
(I changed the name into bs4 before installation, and it went the same after install)
But when I type in from bs4 import beautifulsoup in the code, it says there is no such library.
And I don't see any beautifulsoup.py or something. Isn't there supposed to be one?
I'm really confused. Anyone help please?
|
I cannot import beautiful soup on python
| 57,383,104 | 0 | 8 | 29,930 | 0 |
python,beautifulsoup,python-import
|
If you have a file in the same directory called bs4.py, This is the problem, don't name your files as package names, and btw package names are case-sensitive.
| 0 | 0 | 0 | 0 |
2013-08-08T08:50:00.000
| 3 | 0 | false | 18,121,715 | 0 | 0 | 1 | 2 |
I installed Beautiful Soup library, and it seems to be well set up as there is the bs4 folder in C:\Python33\Lib\site-packages.
(I changed the name into bs4 before installation, and it went the same after install)
But when I type in from bs4 import beautifulsoup in the code, it says there is no such library.
And I don't see any beautifulsoup.py or something. Isn't there supposed to be one?
I'm really confused. Anyone help please?
|
Time out issues with chrome and flask
| 18,130,320 | 0 | 8 | 13,355 | 0 |
python,google-chrome,web-applications,flask
|
Let's assume:
This is not a server issue, so we don't have to go fiddle with Apache, nginx, etc. timeout settings.
The delay is minutes, not hours or days, just to make the scenario manageable.
You control the web page on which the user hits submit, and from which user interaction is managed.
If those obtain, I'd suggest not using a standard HTML form submission, but rather have the submit button kick off a JavaScript function to oversee processing. It would put up a "please be patient...this could take a little while" style message, then use jQuery.ajax, say, to call the long-time-taking server with a long timeout value. jQuery timeouts are measured in milliseconds, so 60000 = 60 seconds. If it's longer than that, increase your specified timeout accordingly. I have seen reports that not all clients will allow super-extra-long timeouts (e.g. Safari on iOS apparently has a 60-second limitation). But in general, this will give you a platform from which to manage the interactions (with your user, with the slow server) rather than being at the mercy of simple web form submission.
There are a few edge cases here to consider. The web server timeouts may indeed need to be adjusted upward (Apache defaults to 300 seconds aka 5 minutes, and nginx less, IIRC). Your client timeouts (on iOS, say) may have maximums too low for the delays you're seeing. Etc. Those cases would require either adjusting at the server, or adopting a different interaction strategy. But an AJAX-managed interaction is where I would start.
| 0 | 0 | 1 | 0 |
2013-08-08T13:20:00.000
| 3 | 0 | false | 18,127,128 | 0 | 0 | 1 | 1 |
I have a web application which acts as an interface to an offsite server which runs a very long task. The user enters information and hits submit and then chrome waits for the response, and loads a new webpage when it receives it. However depending on the network, input of the user, the task can take a pretty long time and occasionally chrome loads a "no data received page" before the data is returned (though the task is still running).
Is there a way to put either a temporary page while my task is thinking or simply force chrome to continue waiting? Thanks in advance
|
Django/Python requirements.txt get always recent package
| 18,146,782 | 3 | 1 | 107 | 0 |
python,django
|
Well, this is a bit of a bad idea. The idea of having a requirements.txt is that you can perfectly replicate what you have on the machine you develop on, i.e exactly the environment it works on.
You can do what you want by just not specifying a version number in requirements.txt, but you are better off manually upgrading each module/package and confirming it works before using it in production.
| 0 | 0 | 0 | 0 |
2013-08-09T12:26:00.000
| 2 | 0.291313 | false | 18,146,661 | 1 | 0 | 1 | 1 |
When I create my requirements.txt I always want it to get the most recent package, without me having to know a version number, how can I do this?
For example I want this to get the latest version of Django:
requirements.txt
Django>=
South==0.7.6
|
OperationalError: (2002, "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)")
| 66,405,102 | 0 | 26 | 101,165 | 1 |
python,mysql,django,mysql.sock
|
I faced this problem when connecting MySQL with Django when using Docker.
Try 'PORT':'0.0.0.0'.
Do not use 'PORT': 'db'. This will not work if you tried to run your app outside Docker.
| 0 | 0 | 0 | 0 |
2013-08-09T15:55:00.000
| 5 | 0 | false | 18,150,858 | 0 | 0 | 1 | 3 |
when connecting to mysql database in Django ,I get the error.
I'm sure mysql server is running.
/var/run/mysqld/mysqld.sock doesn't exist.
When I run $ find / -name *.sock -type s, I only get /tmp/mysql.sock and some other irrelevant output.
I added socket = /tmp/mysql.sock to /etc/my.cnf. And then restared mysql, exited django shell, and connected to mysql database. I still got the same error.
I searched a lot, but I still don't know how to do.
Any help is greate. Thanks in advance.
Well, I just tried some ways. And it works.
I did as follows.
Add socket = /tmp/mysql.sock .Restart the mysql server.
ln -s /tmp/mysql.sock /var/lib/mysqld/mysqld.sock
I met an another problem today. I can't login to mysql.
I'm newbie to mysql. So I guess mysql server and client use the same socket to communicate.
I add socket = /var/mysqld/mysqld.sock to [mysqld] [client] block in my.cnf and it wokrs.
|
OperationalError: (2002, "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)")
| 56,762,083 | 0 | 26 | 101,165 | 1 |
python,mysql,django,mysql.sock
|
in flask, you may use that
app=Flask(__name__)
app.config["MYSQL_HOST"]="127.0.0.1
app.config["MYSQL_USER"]="root"...
| 0 | 0 | 0 | 0 |
2013-08-09T15:55:00.000
| 5 | 0 | false | 18,150,858 | 0 | 0 | 1 | 3 |
when connecting to mysql database in Django ,I get the error.
I'm sure mysql server is running.
/var/run/mysqld/mysqld.sock doesn't exist.
When I run $ find / -name *.sock -type s, I only get /tmp/mysql.sock and some other irrelevant output.
I added socket = /tmp/mysql.sock to /etc/my.cnf. And then restared mysql, exited django shell, and connected to mysql database. I still got the same error.
I searched a lot, but I still don't know how to do.
Any help is greate. Thanks in advance.
Well, I just tried some ways. And it works.
I did as follows.
Add socket = /tmp/mysql.sock .Restart the mysql server.
ln -s /tmp/mysql.sock /var/lib/mysqld/mysqld.sock
I met an another problem today. I can't login to mysql.
I'm newbie to mysql. So I guess mysql server and client use the same socket to communicate.
I add socket = /var/mysqld/mysqld.sock to [mysqld] [client] block in my.cnf and it wokrs.
|
OperationalError: (2002, "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)")
| 72,389,079 | 0 | 26 | 101,165 | 1 |
python,mysql,django,mysql.sock
|
You need to change your HOST from 'localhost' to '127.0.0.1' and check your django app :)
| 0 | 0 | 0 | 0 |
2013-08-09T15:55:00.000
| 5 | 0 | false | 18,150,858 | 0 | 0 | 1 | 3 |
when connecting to mysql database in Django ,I get the error.
I'm sure mysql server is running.
/var/run/mysqld/mysqld.sock doesn't exist.
When I run $ find / -name *.sock -type s, I only get /tmp/mysql.sock and some other irrelevant output.
I added socket = /tmp/mysql.sock to /etc/my.cnf. And then restared mysql, exited django shell, and connected to mysql database. I still got the same error.
I searched a lot, but I still don't know how to do.
Any help is greate. Thanks in advance.
Well, I just tried some ways. And it works.
I did as follows.
Add socket = /tmp/mysql.sock .Restart the mysql server.
ln -s /tmp/mysql.sock /var/lib/mysqld/mysqld.sock
I met an another problem today. I can't login to mysql.
I'm newbie to mysql. So I guess mysql server and client use the same socket to communicate.
I add socket = /var/mysqld/mysqld.sock to [mysqld] [client] block in my.cnf and it wokrs.
|
Python Tornado Websocket Handler blocks while receiving data
| 18,156,111 | 0 | 1 | 407 | 0 |
python,python-3.x,websocket,tornado
|
Tornado works well with large amount of short concurrent requests.
It does not split long request into smaller ones. So process blocks.
Why you passing big amount of data using sockets? Final solution depends on answer to this question.
If you don't have big requests too often - just use haproxy in front of multiple tornado instances.
| 0 | 1 | 0 | 0 |
2013-08-09T21:19:00.000
| 1 | 1.2 | true | 18,155,811 | 0 | 0 | 1 | 1 |
I have two pretty simple Tornado-based websocket handlers running in the same process, each of which function properly on their own. However, when one is receiving a large amount of data (>8MB) the process blocks and the other is unable to process messages until all of the data has been received. Is there any way I can get around this and prevent tornado from blocking here?
|
Jinja2 template rendering multiple or single file
| 18,184,565 | 0 | 0 | 1,032 | 0 |
python,templates,flask,jinja2
|
There is not any performance loss when using template inheritance,You will have to use it in any projects because of Re-usability.But that does not mean you can indefinitely inherit because it will have file read overheads.
| 0 | 0 | 0 | 0 |
2013-08-10T15:48:00.000
| 1 | 0 | false | 18,163,556 | 1 | 0 | 1 | 1 |
I just wonder whether single template rendering's performance is better than multiple template rendering's.
What are the cons and pros of single template rendering considering multiple template rendering?
|
Convert to virtualenv an existing project by copying site-packages
| 18,164,661 | 1 | 0 | 952 | 0 |
python
|
No, you can't. Python packages often have filesystem paths written to various metadata files. Just take the time to go through the site-packages and install the things into a fresh virtualenv, then call pip freeze to get a serialized list that you can use going forward.
| 0 | 0 | 0 | 0 |
2013-08-10T17:40:00.000
| 1 | 1.2 | true | 18,164,647 | 1 | 0 | 1 | 1 |
I have an old Django project that I want to convert to use virtualenv. If I could copy the current global Python packages to the new env, I think I'd be assured that I'd have the same environment and would save myself some time over creating a requirements file by hand. So, could I just copy the global site-packages contents into the env's site-packages directory?
|
Different Django Interfaces for Different user Groups
| 23,327,908 | 0 | 0 | 104 | 0 |
python,django,django-models,django-forms,django-templates
|
I ended up using request.get_host() to provide different interfaces for each subdomain, and check in login for the correct group type of the would-be-logged-in user.
| 0 | 0 | 0 | 0 |
2013-08-11T16:37:00.000
| 1 | 1.2 | true | 18,174,212 | 0 | 0 | 1 | 1 |
I have different user groups based on functionality: customer support, editors...etc
I want to use the same user system and database, but I want to have different interfaces (login, functionality, sub domain) for the different groups that I have, separate from the normal user website interface and login.
How would you do it?
|
Templating library in node.js similar to Jinja2 in Python?
| 63,772,013 | 1 | 22 | 14,114 | 0 |
python,node.js,jinja2,language-comparisons
|
The ejs is the npm module which you are looking for.
This is the name written in my package.json file --> "ejs": "^3.1.3"
EJS is a simple templating language that lets you generate HTML markup with plain JavaScript.(Credits: Ejs website)
| 0 | 0 | 1 | 0 |
2013-08-11T18:49:00.000
| 5 | 0.039979 | false | 18,175,466 | 0 | 0 | 1 | 1 |
What would be a node.js templating library that is similar to Jinja2 in Python?
|
Why would running scheduled tasks with Celery be preferable over crontab?
| 18,190,019 | 49 | 47 | 15,773 | 0 |
python,django,celery,django-celery
|
I've been using cron for a production website, and have switched to celery on a current project.
I'm far more into celery than cron, here is why:
Celery + Celerybeat has finer granularity than cron. Cron cannot run more than once a minute, while celery can (I have a task run every 90 seconds which checks an email queue to send messages, and another which cleans the online users list).
A cron line has to call a script or a unique command, with absolute path and user info. Celery calls python functions, no need to write more than code.
With celery, to deploy to another machine, you generally just have to pull/copy your code, which is generally in one place. Deploying with cron would need more work (you can automate it but...)
I really find celery better suited than cron for routine cleaning (cache, database), and in general, for short tasks. Dumping a database is more a work for cron, however, because you don't want clutter the event queue with too long tasks.
Not the least, Celery is easily distributed across machines.
| 0 | 1 | 0 | 0 |
2013-08-12T13:05:00.000
| 2 | 1.2 | true | 18,187,751 | 0 | 0 | 1 | 2 |
Considering Celery is already a part of the stack to run task queues (i.e. it is not being added just for running crons, that seems an overkill IMHO ).
How can its "periodic tasks" feature be beneficial as a replacement for crontab ?
Specifically looking for following points.
Major pros/cons over crontab
Use cases where celery is better choice than crontab
Django specific use case: Celery vs crontab to run django based periodic tasks, when celery has been included in the stack as django-celery for queing django tasks.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.