Giter Club home page Giter Club logo

getting-started-with-astra-python's Introduction

Getting Started with Apache Cassandra™ and Python using DataStax Astra DB

50 minutes, Intermediate, Start Building

This sample Python backend provides a REST API service that is used with the Getting Started with Astra UI to show a simple example of how to connect to and query DataStax Astra DBs.

image

Astra DB Quick Start

Running on your local machine

If you are familiar with Python, then you've likely gotten your hands on Python virtual environments. We'll be leveraging pyenv while setting up this backend, which will serve our Spacecraft frontend that will have you flying through the stars.

If you aren't familiar with Python, hop over to our official documentation for setting that up on your machine, and come back here after you have it installed ( specifically after Step 5 of the Procedure ).

Now that we have that out of the way, we'll use pyenv to install Python 3.6.9

pyenv install 3.6.9

Next create a new virtualenv using that Python version we just installed.

pyenv virtualenv 3.6.9 astra-venv

Almost off to the races, go ahead and activate that virtualenv

pyenv activate astra-venv

Woot, now 3 quick dependencies ( Flask, Flask CORS, and the DataStax Cassandra Driver )

pip install Flask flask-cors cassandra-driver

Last one, clone this repo

git clone https://github.com/DataStax-Examples
/getting-started-with-astra-python.git

If everything above went smoothly, fingers crossed, then we are ready to rock. Go to the directory that you just cloned this repo into

cd getting-started-with-astra-python

Fire up the engines

FLASK_ENV=development FLASK_APP=getting_started_with_astra.py flask run

You should be met with the following output, note that it's running on localhost and port 5000

 * Serving Flask app "getting_started_with_astra.py" (lazy loading)
 * Environment: development
 * Debug mode: on
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
 * Restarting with stat
 * Debugger is active!
 * Debugger PIN: 204-527-831

Once the backend is running, you can start the Getting Started with Astra UI in order to use a web page that leverages this backend.

getting-started-with-astra-python's People

Contributors

beccam avatar kidrecursive avatar msmygit avatar zoranpandovski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

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.