GithubHelp home page GithubHelp logo

db_project_travelagent's Introduction

🌐 TRAVELLO

A travel planner website UI integrated with PostgreSQL. User can register and sign in.


Functions

Customers

  • register, login, logout
  • search for tours
  • book tours

Guides

  • login, logout
  • check own schedule & details of a tour he/she is responsible for

Setup

DB

(source code的tables)

  1. download PostgreSQL 14 and pgAdmin (GUI介面)

  2. Open pgAdmin4,在PostgreSQL/Database按右鍵 -> Create Database -> 命名為DB_travel

    drawing
    • 首次下載pgAdmin 如果系統要求設定user password,則設為postgres

      drawing
  3. DB_travel 按右鍵,選Query Tool

    drawing

    按下左上角資料夾按鈕(Open file),在跳出的視窗中選取 db.sql 的路徑,按右下角Select

    drawing

    在 Query Editor 中會自動出現新增資料與表格的queries,按下右上角的 Run 按鈕來執行。完成後Refresh Schema,即可看到所有表格

    drawing
  4. 為了在新增資料時,postgresql能夠依據已匯入的資料id來生成新id,需在Query Editor輸入以下指令並執行。

    SELECT setval('accounts_member_id_seq', (SELECT MAX(id) from public.accounts_member));
    SELECT setval('accounts_guide_id_seq', (SELECT MAX(id) from public.accounts_guide));
    SELECT setval('travelloapp_tour_id_seq', (SELECT MAX(id) from public.travelloapp_tour));
    SELECT setval('calc_order_id_seq', (SELECT MAX(id) from public.calc_order));
    SELECT setval('calc_tourist_id_seq', (SELECT MAX(id) from public.calc_tourist));
    
  5. Open travello/settings.py, use the correct 'PASSWORD' in DATABASES.

Backend

All are done in the root directory

  1. set virtual environment

    # for windows
    pip install virtualenv
    py -3 -m venv .venv
    .venv\scripts\activate
    # for mac(不確定是不是這樣)
    pip install virtualenv
    virtualenv venv
    source venv/bin/activate
  2. install packages

    pip install -r requirements.txt
    # OR
    python -m pip install -r requirements.txt
  3. start server

    python manage.py makemigrations
    python manage.py migrate
    python manage.py runserver
    # https://127.0.0.1:8000 in your browser

Create SUPER USER

python manage.py createsuperuser
  • Set username & password as you like
  • Go to http://127.0.0.1:8000/admin/ Add some testing data and check in pgAdmin to see if the tables have updated some new rows.

Built Using


Reference

db_project_travelagent's People

Contributors

jennahsuan avatar rlungwu 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.