In the middle of writing. unfinished
Register with IBM BlueMix
Creating a space dev
http://www.creationline.com/lab/8055
I'm doing it with CLI here, but I think I could do it normally with GUI.
Go to dashboard Select a catalog from the menu Select Python If the name specified at this time overlaps with an existing one, it cannot be added. Select the one you added on the dashboard Add the Watson Question & Answer service by adding the service. At the time of addition, the URL, ID, and password for using the API have been issued.
Q & A is one of the services added to the dashboard. If you display the credentials here, you can check the url, id, password. Also, there is a link to the document to the right of the credential display, so take a look. Looking at the api reference in the documentation, they are all REST APIs. In this case, I think that the REST API should be recognized as returning a JSON-formatted response when accessed by url. To skip the ping to the Q & A API, it says v1 / ping. Try accessing it with a browser and check it. I'm returning 200 as an http request response, but I see an empty JSON on the browser {} Try accessing it from the terminal. ..
curl -X GET -H "Accept: application/json" -u d1447bde-bb6f-4db9-b073-eb8faadcf96d:6aX7RxuNFtJp https://gateway.watsonplatform.net/question-and-answer-beta/api/v1/ping {} https://access.redhat.com/documentation/ja-JP/Red_Hat_Enterprise_Virtualization/3.0/html/REST_API_Guide/appe-REST_API_Guide-cURL_Integration.html
curl -u d1447bde-bb6f-4db9-b073-eb8faadcf96d:6aX7RxuNFtJp -LI https://gateway.watsonplatform.net/question-and-answer-beta/api/v1/ping -o /dev/null -w '%{http_code}\n' -s 200
http://sugamasao.hatenablog.com/entry/20120326/1332754813
Web application development using Django http://www.ibm.com/developerworks/jp/cloud/library/cl-worldbank-charting-app/ Let's try only steps 1 and 2 here. It is displayed as It works.
Next, let's deploy this. Select an app from the dashboard Choose to start coding If you select the CF command line interface, the explanation will appear, so follow it.
http://www.ibm.com/developerworks/jp/cloud/library/cl-worldbank-charting-app/ Follow step 4 of step 4 to upload your Django project on BlueMix. Just write the environment information in requirement.txt and the environment will be built on the server. Feel the future of today.
Django http://www.ibm.com/developerworks/jp/cloud/library/cl-worldbank-charting-app/
git clone https://hub.jazz.net/git/mamtasharma/trendsapp001 And download the source
manifest.yml Change name to a unique name Delete the build line
For the time being, I want to move Django somehow, so the details are insects cf push --no-start cf create-service mongodb 100 mongodb001 cf bind-service trendsapp001 mongodb001 cf start trendsapp001
Access url / trends It worked.
Go to the dashboard and go to the app page With the addition of services
https://developer.ibm.com/answers/questions/181645/question-validation-failed-error-when-making-post.html Can not! Python Script
request.py
import requests
import json
qt = "How deep is grand canyon?"
url = "https://gateway.watsonplatform.net/question-and-answer-beta/api/v1/question/travel"
r = requests.post(url,
data=json.dumps({"question": {"questionText": qt}}),
headers={"Content-Type": "application/json", "X-SyncTimeout": 30},
auth=("0b46d272-3d88-47c7-afa5-9127919e83a6", "yhxjoHEq3dmP"))
print r.text
Since Django 1.7 has been using new features, Not very helpful in the past. http://a-records.info/2014/09/29/18/
Recommended Posts