# Quick Start

Welcome to the Django, your go-to foundation for building powerful web applications with Django, HTML5, and Bootstrap 5.\*. This guide will walk you through the steps to set up and start us.

## Prerequisites

Before you begin, make sure you have the following installed on your machine:

* [Node.js](https://nodejs.org/) ( Node v20.\*)
* [Python](https://www.python.org/) (3.6 or higher)
* [Django](https://www.djangoproject.com/) (4.2 or higher)
* A code editor of your choice (e.g., Visual Studio Code, Atom, Sublime Text, etc)

## Build Assets <a href="#build-assets" id="build-assets"></a>

Before running the application we need to build theme assets:

1. Open your project to vs code.
2. Start a command prompt window or terminal and change directory to Lightable-Node/
3. Install packages using one of following commands

{% code fullWidth="false" %}

```sh
yarn install
OR
npm install
```

{% endcode %}

{% hint style="success" %}
This command will fetch all dependencies listed in `/package.json` and place them into`/node_modules` folder.
{% endhint %}

4. You can use [Gulp](https://preview.keenthemes.com/nodejs/metronic/docs/getting-started/build/gulp.html)  command to bundle theme assets. The below command will compile all the assets(sass, js, media) to `/public/assets` folder:

```batch
gulp
```

## Install Python <a href="#install-python" id="install-python"></a>

Django is a Python web framework. See [What Python version can I use with Django?](https://docs.djangoproject.com/en/4.0/faq/install/#faq-python-version-support)  for details.

1. Get the latest version of Python at <https://www.python.org/downloads/>  or with your operating system’s package manager.
2. Download the executable installer and run it.
3. After installation, open the command prompt and check that the Python version matches the version you installed by executing:

{% code fullWidth="false" %}

```sh
python --version
```

{% endcode %}

#### Check Pip Version

```batch
py -m pip --version
upgrade pip
py -m pip install --upgrade pip
```

#### Virtualenv

Make sure to have the `virtualenv` installed globally & running on your computer. If you already have installed on your computer, you can skip this step.

Virtualenv installation command for Linux & mac os

```batch
python3 -m pip install --user virtualenv

```

Virtualenv installation command for Windows

```batch
py -m pip install --user virtualenv

```

Activate Virtual Environment on Windows OS

environment-name/Scripts/activate

#### Django

Install Django on linux & mac OS

```bash
python -m pip install Django
```

Install Django on Windows OS

```bash
py -m pip install Django
```

<mark style="color:red;">`Note:`</mark> Depending on your installation, you may need to use either pip3 or pip and for python you may need to use either python3 or python.

#### Run Project

{% hint style="info" %}
You have x unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions. Run 'python manage.py migrate' to apply them.
{% endhint %}

```bash
python manage.py migrate
```

#### Setting up Static Files

Go to light\_able\_django/settings.py and add following command:-

````javascript
```python
STATIC_URL = '/static/'
STATICFILES_DIRS = [os.path.join(BASE_DIR,'public/assets')]
STATIC_ROOT = os.path.join(BASE_DIR,'static')

MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
```
````

#### Run below command for run your project

```batch
python manage.py runserver
```
