Coder Social home page Coder Social logo

django_api's Introduction

django_api

WebAPIを試すだけのDjango用プロジェクト
top

Windows10向け
※その他OSは動作未確認(たぶん動く)

目次

  • 導入手順
  • 起動方法
  • 確認方法
  • 処理の概要

導入手順

python3.xのインストール
python(バージョンは3以上)をインストールしてください。
参考:https://www.python.jp/install/windows/install_py3.html

pythonとpipコマンドの環境変数設定
コマンドプロンプトで「python」や「pip」を実行できるよう設定してください。
参考:https://www.javadrive.jp/python/install/index3.html

Djangoライブラリのインストール
djangoライブラリをインストールしてください。

pip install django  

本ソースコードのダウンロード
ローカル環境の好きな場所にダウンロードしてください。

git clone https://github.com/mikenomist/django_api.git  

起動方法

ディレクトリ移動
ダウンロードしたソースコードのディレクトリまで移動してください。

cd ディレクトリパス\django_api  

デバッグモード起動
Djangoのデバッグモードを使って自PCを仮想サーバとして起動します。

python manage.py runserver  

runserver

確認方法

ブラウザへのアクセス
好きなブラウザ(Chrome推奨)を開いて http://127.0.0.1:8000/ にアクセスします。
「送信」ボタンを押下して数字が変わったら成功。
APIの実行
コマンドプロンプトでcurlコマンドやpythonでリクエストを投げて正常に返ってくれば成功。

curl http://127.0.0.1:8000/api/count/  

curl

処理の概要

画面上処理:「送信」ボタンを押すことを検知すると、jQueryのAjaxを使って http://127.0.0.1:8000/api/count/ へアクセスする

サーバ側処理:リクエストがあればその都度、数字をランダムに生成してレスポンスする

画面上処理:レスポンスを受け取ると、数字の記載場所に受け取った数字になるまで数値を0から1ずつ足していく
django_api_flow

django_api's People

Contributors

mikenomist avatar

Watchers

 avatar

django_api's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.