Skip to content

Commit f1b6262

Browse files
committed
Simplify frontend
1 parent fbea8c2 commit f1b6262

File tree

19 files changed

+41
-267
lines changed

19 files changed

+41
-267
lines changed

.github/workflows/shared-build/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ runs:
4646
run: pip install "django>=4,<5"
4747
shell: bash
4848
- name: Setup testproject
49-
run: django-admin startproject testproject --extension py,yml,json --name Procfile,README.md,.env.example,Dockerfile,Makefile,pyproject.toml,render.yaml --template=.
49+
run: django-admin startproject testproject --extension py,json,yml,toml --name Dockerfile,README.md,.env.example,.gitignore,Makefile --template=.
5050
shell: bash
5151
- run: |
5252
npm update --save

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ If you made changes to this boilerplate and want to test them, do as follows:
1515
- Run `git archive -o boilerplate.zip HEAD` to create the template zip file
1616
- Run the following:
1717
```bash
18-
cd .. && django-admin startproject theprojectname --extension py,yml,json --name Procfile,README.md,.env.example,Dockerfile,docker-compose.yml,Makefile,pyproject.toml,render.yaml --template=django-react-boilerplate/boilerplate.zip
18+
cd .. && django-admin startproject theprojectname --extension py,json,yml,toml --name Dockerfile,README.md,.env.example,.gitignore,Makefile --template=django-react-boilerplate/boilerplate.zip
1919
```
2020
- A new folder called `theprojectname` will be created and now you can test your changes
2121
- Make sure that the project is still running fine with and without docker

README.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ Send us an email at [email protected] telling us a bit more about how ou
6969
- [ ] Open the command line and go to the directory you want to start your project in.
7070
- [ ] Start your project using:
7171
```
72-
django-admin startproject theprojectname --extension py,yml,json --name Procfile,Dockerfile,docker-compose.yml,README.md,.env.example,.gitignore,Makefile,render.yaml --template=https://github.com/vintasoftware/django-react-boilerplate/archive/boilerplate-release.zip
72+
django-admin startproject theprojectname --extension py,json,yml,toml --name Dockerfile,README.md,.env.example,.gitignore,Makefile --template=https://github.com/vintasoftware/django-react-boilerplate/archive/boilerplate-release.zip
7373
```
7474
Alternatively, you may start the project in the current directory by placing a `.` right after the project name, using the following command:
7575
```
76-
django-admin startproject theprojectname . --extension py,yml,json --name Procfile,Dockerfile,docker-compose.yml,README.md,.env.example,.gitignore,Makefile,render.yaml --template=https://github.com/vintasoftware/django-react-boilerplate/archive/boilerplate-release.zip
76+
django-admin startproject theprojectname . --extension py,json,yml,toml --name Dockerfile,README.md,.env.example,.gitignore,Makefile --template=https://github.com/vintasoftware/django-react-boilerplate/archive/boilerplate-release.zip
7777
```
7878
In the next steps, always remember to replace theprojectname with your project's name
7979
- [ ] Above: don't forget the `--extension` and `--name` params!
@@ -181,7 +181,7 @@ mkdir -p .github/workflows
181181
mv proj_main.yml .github/workflows/main.yml
182182
```
183183

184-
## Deployment
184+
## Production Deployment
185185
### Setup
186186
This project comes with an `render.yaml` file, which can be used to create an app on Render.com from a GitHub repository.
187187

@@ -197,17 +197,21 @@ If you are in a private repository, access the following link replacing `$YOUR_R
197197

198198
Remember to fill the `ALLOWED_HOSTS` with the URL of your app, the default on Render.com is `appname.onrender.com`. Replace `appname` with your Render.com app name.
199199

200-
### Configuring Celery
200+
### Celery
201201

202202
As there aren't free plans for Workers in Render.com, the configuration for Celery workers/beat will be commented by default in the `render.yaml`. This means celery won't be available by default.
203203

204204
Uncommenting the worker configuration lines on `render.yaml` will imply in costs.
205205

206206
### SendGrid
207207

208-
To enable sending emails from your application you'll need to have a valid SendGrid account and also a valid verified sender identity. After finishing the validation process you'll be able to generate the API credentials and define the `SENDGRID_USERNAME` and `SENDGRID_PASSWORD` envvars on Render.com.
208+
To enable sending emails from your application you'll need to have a valid SendGrid account and also a valid verified sender identity. After finishing the validation process you'll be able to generate the API credentials and define the `SENDGRID_USERNAME` and `SENDGRID_PASSWORD` environment variables on Render.com.
209209

210-
These variables are required for your application to work on Render.com since it's pre-configured to automatically email admins when the application is unable to handle errors gracefully.
210+
These variables are required for your application to work on Render.com since it's pre-configured to automatically email admins when the application is unable to handle errors gracefully.
211+
212+
### Media storage
213+
214+
Media files integration with S3 or similar is not supported yet. Please feel free to contribute!
211215

212216
### Sentry
213217

backend/common/views.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
from django.views import generic
22

3-
from rest_framework import status, viewsets
3+
from rest_framework import viewsets, status
44
from rest_framework.decorators import action
5-
from rest_framework.permissions import AllowAny
65
from rest_framework.response import Response
6+
from rest_framework.permissions import AllowAny
77

88

99
class IndexView(generic.TemplateView):
@@ -19,6 +19,9 @@ class RestViewSet(viewsets.ViewSet):
1919
)
2020
def rest_check(self, request):
2121
return Response(
22-
{"result": "If you're seeing this, the REST API is working!"},
22+
{
23+
"result": "This message comes from the backend. "
24+
"If you're seeing this, the REST API is working!"
25+
},
2326
status=status.HTTP_200_OK,
2427
)

backend/templates/common/index.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33

44
{% block body %}
5-
<h1>Django React Boilerplate Example App</h1>
6-
7-
<p>The setup of the Django React Boilerplate Example App was successful.</p>
8-
9-
<h2>React Example App</h2>
10-
<p>Here is an example of a React app included in the Django framework:</p>
11-
12-
<div id="react-app"></div>
5+
<div class="container">
6+
<h1>Django React Boilerplate Example App</h1>
7+
<p>
8+
Below is an example of a React app included in the Django template.<br/>
9+
Check <code>backend/templates/common/index.html</code> and <code>frontend/js/index.js</code> to understand how they're linked:
10+
</p>
11+
</div>
12+
<div class="container" id="react-app"></div>
1313
{% endblock %}

frontend/js/App.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1+
import * as Sentry from "@sentry/react";
12
import React from 'react';
23
import { Provider } from 'react-redux';
34

45
import Home from './pages/Home';
56
import configureStore from './store';
6-
import SentryBoundary from './utils/SentryBoundary';
77

88
const store = configureStore({});
99
const App = () => (
10-
<SentryBoundary>
10+
<Sentry.ErrorBoundary fallback={<p>An error has occurred</p>}>
1111
<Provider store={store}>
1212
<Home />
1313
</Provider>
14-
</SentryBoundary>
14+
</Sentry.ErrorBoundary>
1515
);
1616

1717
export default App;

frontend/js/app/example-app/components/ColorChanger/ColorChanger.js

Lines changed: 0 additions & 62 deletions
This file was deleted.

frontend/js/app/example-app/components/ColorChanger/ColorDisplay/ColorDisplay.js

Lines changed: 0 additions & 24 deletions
This file was deleted.

frontend/js/app/example-app/components/ColorChanger/ColorDisplay/index.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

frontend/js/app/example-app/components/ColorChanger/ColorDisplay/style.scss

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)