Coder Social home page Coder Social logo

tata-sales's Introduction

TATA Sales

Note : The Security Key in the Settings.py file is not provided in the code for security Reasons , Please make a new project and copy all the contents or email me for security key

Virtual Environment

Assumes you have python3...

  1. Fork the repo on github to get a copy of the respository, and then cloned that newly forked repo with git clone
  2. Create a virtual environment with the python -m venv .venv .This will a sandboxed environment called "venv" that helps with controlling dependencies.
  3. Activate the environment with source .venv/bin/activate
  4. Install all the application's dependencies (while in the activated virtual environment) with pip install -r requirements.txt.

Database

Since we want to use postgres as our production database, we should make sure that any local development is also done with postgres. Setting postgres up to run on a machine locally is more of a hassle than the default 'db.sqlite3' database that django, but using it locally ensures that no weird errors crop up by having different database implementations across environments development and production environments.

To Setup up Postgres Locally on a Mac

  1. Install homebrew if it's not already on your Mac.
  2. Update brew with brew update.
  3. Install postgres with brew install postgres.
  4. To start postgres consistently run in the background, use the command brew services start postgresql. If you'd prefer to start it manually and not have it automatically start use pg_ctl -D /usr/local/var/postgres start.
  5. Make sure that everything is working properly by entering postgres's command line interface with psql postgres. You should see you enter a shell that looks like postgres=#.
  6. Once in the interface, create a new database named djangotutorial with the command CREATE DATABASE djangotutorial; If creating the database succeeds, you will see the response CREATE DATABASE. This will be the database that our django application will connect and write to for local development.
  7. For anyone to connect and access the database we created, they need a valid postgres username and password combination. This means that we need to create a dedicated user for django to interact with our new database. We create it with CREATE USER djangotutorial WITH PASSWORD 'supersecret';
  8. Our new postgres user needs explicit permission to have read and write capabilities on our newly created database. We can do that with the command GRANT ALL PRIVILEGES ON DATABASE "djangotutorial" to djangotutorial; .
  9. Exit out of postgres

Connect Postgres with Django

  1. Make sure you have your postgres username and Database name before doing this step
  2. Go the settings.py in the main app (tata) and modify the database values according to your configration
  3. Make migrations using Python3 manage.py makemigrations
  4. Then use the migrate command Python3 manage.py migrate
  5. Run the Server to see Everything went right python3 manage.py runserver

tata-sales's People

Contributors

rishisy 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.