diff --git a/Dockerfile b/Dockerfile index 5805b05..8f05770 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,18 +7,18 @@ RUN yarn install COPY frontend/ /app/frontend/ RUN yarn build -COPY webpack-stats.json /app/ - # Stage 2: Build the Django app FROM python:3.10-alpine WORKDIR /app COPY requirements.txt /app/ +COPY --from=react-build /app/ /app/ RUN pip install --no-cache-dir -r requirements.txt COPY . /app/ +RUN python manage.py makemigrations +RUN python manage.py migrate RUN python manage.py collectstatic --no-input - # Start the Django app -CMD ["gunicorn", "--config", "gunicorn-cfg.py", "core.wsgi"] \ No newline at end of file +CMD ["gunicorn", "--config", "gunicorn-cfg.py", "core.wsgi"] diff --git a/README.md b/README.md index 9d7c975..0bd3e9b 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,10 @@ -# [Django & React Codebase](https://github.com/app-generator/django-react-starter) +# [Django & React](https://blog.appseed.us/how-to-integrate-django-with-react/) `Codebase` -Open-source **Django Starter** bundled with React, React-Flow - Actively supported by AppSeed. +Open-source **Django Starter** bundled with React, React-Flow provided by [App-Generator](https://app-generator.dev/). The code for this starter is fully explained [here](https://blog.appseed.us/how-to-integrate-django-with-react/). -- 👉 [Django & React](https://django-react-starter.onrender.com/) - `LIVE deployment` +- 👉 [Django & React](https://django-react-starter.onrender.com/charts) - `LIVE deployment` + - [ReCharts](https://django-react-starter.onrender.com/charts) `sample page` + - [ReactFlow](https://django-react-starter.onrender.com/flow) `sample page` - 🚀 Free [Support](https://appseed.us/support/) via `Email` & `Discord`
@@ -11,7 +13,7 @@ Open-source **Django Starter** bundled with React, React-Flow - Actively support - 🚀 `Stack`: **Django** & **React** - ✅ Tooling: `Webpack` -- ✅ `Design`: [Django Theme Datta](https://github.com/app-generator/django-admin-datta) - `Free Version` +- ✅ `Design`: [Datta Able](https://app-generator.dev/product/datta-able/) - `Free Version` - ✅ `Sections` covered by the design: - ✅ **Admin section** (reserved for superusers) - ✅ **Authentication**: `Django.contrib.AUTH`, Registration @@ -20,7 +22,7 @@ Open-source **Django Starter** bundled with React, React-Flow - Actively support
-[![Django & React Codebase - Free Starter by AppSeed.](https://user-images.githubusercontent.com/51070104/229304184-ed3cd761-9a43-43f0-90ba-9a2fcb0a4534.png)](https://github.com/app-generator/django-react-starter) +[![Django & React - Open-Source Starter](https://user-images.githubusercontent.com/51070104/230912843-2c670ac7-2ce6-4289-8e00-7ccca1f3a67f.gif)](https://blog.appseed.us/how-to-integrate-django-with-react/)
@@ -66,14 +68,14 @@ $ yarn build # production build
-### 👉 Set Up for `Unix`, `MacOS` +### 👉 Build `Django Backend` > Install modules via `VENV` ```bash $ virtualenv env $ source env/bin/activate -$ pip3 install -r requirements.txt +$ pip install -r requirements.txt ```
@@ -105,15 +107,19 @@ Open the Django shell and create manually new records: ```python $ python manage.py shell >>> from apps.home.models import Sales ->>> s1 = Sales() # use the default country `USA` ->>> s2 = Sales() # use the default country `USA` +>>> +>>> s1 = Sales() # Use the default country `USA` +>>> s1.save() +>>> +>>> s2 = Sales() # Use the default country `USA` +>>> s2.save() >>> >>> s3 = Sales() ->>> s3.country = 'ger' # a sale from Germany +>>> s3.country = 'ger' # Create a sale from `Germany` >>> s3.save() >>> >>> s4 = Sales() ->>> s4.country = 'france' # a sale from France +>>> s4.country = 'france' # Ans another one from France >>> s4.save() ``` @@ -148,4 +154,4 @@ The project is coded using a simple and intuitive structure presented below:
--- -[Django & React Codebase](https://github.com/app-generator/django-react-starter) - `Open-Source` starter crafted by **[AppSeed](https://appseed.us)**. +[Django & React](https://blog.appseed.us/how-to-integrate-django-with-react/) `Codebase` - `Open-Source` starter crafted by **[App-Generator](https://app-generator.dev/)**. diff --git a/build.sh b/build.sh index e41d99e..bd039bc 100755 --- a/build.sh +++ b/build.sh @@ -11,5 +11,7 @@ python -m pip install --upgrade pip pip install -r requirements.txt -python manage.py collectstatic --no-input +python manage.py makemigrations python manage.py migrate + +python manage.py collectstatic --no-input diff --git a/package.json b/package.json index 29c067e..7cc801e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "django-react-starter", - "version": "2.0.0", + "version": "1.0.1", "description": "Starter repo for serving a React SPA from Django", "main": "index.js", "scripts": {