Coder Social home page Coder Social logo

polsource_task's Introduction

Polsource_Task

Python Framework

NoteAPI that enable users to create, read, update and delete notes.

Table of Contents


Requirements

Note, that if you don't want to install this project on your device, go directly into Run Project Demo section of this repository.

To run this project, you'll need Python 3 and flask module. When you download (or clone) this repository, go into command line, go to project directory and:

a) create env (optional but recommended)

b) type pip install -r requirements.txt (make sure that you're in directory with this file)

After some time (pip needs to install all requirements), the project is ready to go.


Database Setup

You don't need to do anything more than run project. If you want to see SQL commands that create database, go to database directory and open sql_scripts.py file in any IDE of your choice. Why is that so, that you don't need to do anything special? If you look into main.py file, in line 97 we're creating new instance of Database class. And when you look at code of this class, you'll see that we're creating "new" database. The thing is that it won't be created unless there's nothing in database file (SQL is "CREATE IF NOT EXISTS").


Run Project

To run project, simply type python main.py in your command line. This will make a flask server, most probably on your localhost. To test it, please go to this repository, where you'll find detailed instruction of how to set up frontend part. Please note, that you'll need to change one thing in there, because frontend was created with another URL (more about it in Run Project Demo section).

You can also run tests if you want so.


Run Project Demo

If you don't want to install anything on your device, you can check this server in another way. Go to this site, where you'll see something like this: Repl Click on green button with arrow to run the server!

Then click on the link under Live Demo section to go to NoteIT web application for looking how it works in real life.

Repl2

For more details on UI, go to this repository.


Example usages

You can use this project as I've shown in Run Project Demo section (for fun) or in previous sections (for making your own version of this API and NoteIT app).


Project Sturcture

Project consists few important files, mostly in database directory:

  • database - directory with all files that are used in notes persistance
    • Database.py - file with Database class, wrapper for QueryExecutor class. Prepares notes, creates connection to database.
    • Note.py - file that consists Note class
    • QueryExecutor.py - file with QueryExecutor class that operates on database.
    • sql_scripts.py - file with SQL Scripts to create database.
  • src/exceptions/Exceptions.py - file that contains several custom exceptions.
  • templates/index.html - file with HTML code for start page of API.
  • tests - directory with tests for CRUD operations.
  • definitions.py - file with some constants.
  • main.py - main flask file with all endpoints.

polsource_task's People

Contributors

davenury avatar

Watchers

 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.