Skip to content

Commit 8fe55f1

Browse files
authoredNov 16, 2022
Merge pull request #3 from TokyoPython/fix/add-requests-dependency
Fix/add requests dependency
2 parents 416e95c + 95bdc8d commit 8fe55f1

File tree

9 files changed

+106
-173
lines changed

9 files changed

+106
-173
lines changed
 

‎front/README.md

+3-50
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,4 @@
1-
# Below is the default readme provided by the theme. See DEV_NOTES.md for more information on developing here
2-
3-
🚀 Landing Page theme written in Next.js, Tailwind CSS and TypeScript ⚡️ Made with developer experience first: Next.js, TypeScript, ESLint, Prettier, Husky, Lint-Staged, VSCode, Netlify, PostCSS, Tailwind CSS.
4-
5-
Clone this project and use it to create your own [Next.js](https://nextjs.org) project. You can check a [Next js templates demo](https://creativedesignsguru.com/demo/nextjs-landing-page/).
6-
7-
### DEMO
8-
9-
[![Nextjs Landing Page Template Screenshot](public/assets/images/nextjs-landing-page-screenshot.png?raw=true)](https://creativedesignsguru.com/demo/nextjs-landing-page/)
10-
11-
Check out our [live demo](https://creativedesignsguru.com/demo/nextjs-landing-page/).
1+
# This is the default readme provided by the originally packaged theme.
122

133
### Features
144

@@ -36,16 +26,6 @@ Built-in feature from Next.js:
3626
- 💨 Live reload
3727
- ✅ Cache busting
3828

39-
### Included Components
40-
41-
- Navbar
42-
- Hero
43-
- Features
44-
- CTA banner
45-
- Footer
46-
47-
Find more components in our [premium NextJS themes](https://creativedesignsguru.com/category/nextjs/).
48-
4929
### Philosophy
5030

5131
- Minimal code
@@ -58,47 +38,21 @@ Build your SaaS product faster with [React SaaS Boilerplate](https://nextlessjs.
5838

5939
[![React SaaS Boilerplate Next.js](https://creativedesignsguru.com/assets/images/themes/next-js-saas-starter-kit.jpg)](https://nextlessjs.com)
6040

61-
### Premium Themes
62-
63-
| [Green Nextjs Landing Page Template](https://creativedesignsguru.com/landing-green-modern-nextjs-theme/) | [Purple Saas Nextjs Theme](https://creativedesignsguru.com/landing-purple-modern-react-theme/) |
64-
| --- | --- |
65-
| [![Green Nextjs Landing Page Template](https://creativedesignsguru.com/assets/images/themes/landing-green-modern-nextjs-theme-xs.png)](https://creativedesignsguru.com/landing-green-modern-nextjs-theme/) | [![Blue Landing Page Nextjs Theme](https://creativedesignsguru.com/assets/images/themes/landing-blue-modern-nextjs-theme-xs.png)](https://creativedesignsguru.com/landing-blue-modern-react-theme/) |
66-
67-
Find more [Nextjs Templates](https://creativedesignsguru.com/category/nextjs/).
68-
6941
### Requirements
7042

7143
- Node.js and npm
7244

73-
### Getting started
74-
75-
Run the following command on your local environment:
76-
77-
```
78-
git clone --depth=1 https://github.com/ixartz/Next-JS-Landing-Page-Starter-Template.git my-project-name
79-
cd my-project-name
80-
npm install
81-
```
82-
83-
Then, you can run locally in development mode with live reload:
84-
85-
```
86-
npm run dev
87-
```
88-
89-
Open http://localhost:3000 with your favorite browser to see your project. For your information, Next JS need to take some time to compile the project for your first time.
90-
45+
### A Peek Inside (May differ from current setup)
9146
```
9247
.
9348
├── README.md # README file
9449
├── next.config.js # Next JS configuration
9550
├── public # Public folder
9651
│ └── assets
97-
│ └── images # Image used by default template
52+
│ └── images # Images used by the app
9853
├── src
9954
│ ├── background # Atomic background component
10055
│ ├── button # Atomic button component
101-
│ ├── cta # Atomic cta component
10256
│ ├── feature # Atomic feature component
10357
│ ├── footer # Atomic footer component
10458
│ ├── hero # Atomic hero component
@@ -124,7 +78,6 @@ You can easily configure the theme. Please change the following file:
12478
- `src/templates/*`: the list of component blocks
12579
- `src/*`: other folders in src are the atomic components used by components blocks
12680

127-
Here is the layer:
12881

12982
- the entry point: `index.tsx` in `src/pages`
13083
- the `Base` template: `Base.tsx` in `src/templates`

‎front/src/cta/CTABanner.tsx

-22
This file was deleted.

‎front/src/layout/Layout.tsx

+19-12
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,32 @@ import { Base } from '../templates/Base';
66
import { Footer } from '../templates/Footer';
77
import { Header } from '../templates/Header';
88
import { Hero } from '../templates/Hero';
9+
import { AppConfig } from '../utils/AppConfig';
10+
import { Meta } from './Meta';
911
import { Section } from './Section';
1012

1113
export default function Layout({ children }: { children: ReactNode }) {
1214
const router = useRouter();
13-
14-
if (router.pathname === '/') {
15-
return (
16-
<>
17-
<Header />
18-
<Hero />
19-
<Base />
20-
<Footer />
21-
</>
22-
);
23-
}
15+
console.log(children);
2416
return (
2517
<>
18+
<Meta
19+
title={
20+
router.pathname === '/'
21+
? AppConfig.title
22+
: `Tokyo Python: ${router.pathname}`
23+
}
24+
description={AppConfig.description}
25+
/>
2626
<Header />
27-
<Section>{children}</Section>
27+
{router.pathname === '/' ? (
28+
<>
29+
<Hero />
30+
<Base />
31+
</>
32+
) : (
33+
<Section>{children}</Section>
34+
)}
2835
<Footer />
2936
</>
3037
);

‎front/src/templates/Banner.tsx

-25
This file was deleted.

‎front/src/templates/Base.tsx

-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
1-
import { Meta } from '../layout/Meta';
2-
import { AppConfig } from '../utils/AppConfig';
31
import { VerticalFeatures } from './VerticalFeatures';
42

5-
// The base information for the landing page
6-
73
const Base = () => (
84
<div className="antialiased text-gray-600">
9-
<Meta title={AppConfig.title} description={AppConfig.description} />
105
<VerticalFeatures />
116
</div>
127
);

‎front/src/templates/EventsBanner.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const EventsBanner = () => {
1717
const eventsList: IEventResponse[] = response!.data.groupeventlist;
1818
setData(eventsList);
1919
} catch (error) {
20+
console.log(error);
2021
// Axios / network error
2122
setVisible(false);
2223
setData([

‎front/src/utils/AppConfig.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// API refers to the backend endpoint
2+
const API = 'http://localhost:8000';
3+
14
export const AppConfig = {
25
site_name: 'Tokyo Python Society',
36
title: 'Tokyo Python Society',
@@ -18,6 +21,6 @@ export const AppConfig = {
1821
},
1922
},
2023
API: {
21-
MEETUP_URL: process.env.NEXT_PUBLIC_MEETUP_URL,
24+
MEETUP_URL: API,
2225
},
2326
};

‎readme.md

+75-58
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,122 @@
11
# Tokyo Python Society Site - Overview Proposal
22

3-
## Tools Used in Development
3+
# Getting Started
44

5-
Language: Python 3.10
6-
Libraries: FastAPI
7-
Database: Postgres (version to be determined) (10/29 currently not in use, installation not required)
8-
Formatter: Black 22.8.0
9-
Testing: PyTest
10-
Front: JavaScript, Reactjs, Nextjs
5+
## Requirements:
116

12-
## Frontend
13-
The frontend is compiled and bundled with Nextjs from a barebones template design.
7+
Python 3.10
8+
NodeJS v14.15.0 and npm
149

15-
For more information for design decisions and implementation please see `front/README.md`
10+
# Setting up the Backend
1611

17-
## Branch Information
12+
## Step 1
1813

19-
- main
20-
As of 10/29 we are committing directly to main, as the content is not yet ready to be opened up to the public to be worked on.
14+
Clone repository
2115

22-
- production
23-
This is the production branch. Changes to this branch will ultimately affect the live site.
24-
10/22: As of now, there is no production branch. It will not be ready until the site is at least somewhat presentable
16+
`git clone git@github.com:TokyoPython/tokyo-python-society-site.git`
2517

26-
- dev
27-
This is the development branch. Changes to this branch are local.
18+
## Step 2
2819

29-
## Setting Up the Environment (Back)
20+
Create Python virtual environment within the project root directory
3021

31-
1. Install Python 3.10
22+
```bash
23+
$ cd tokyo-python-society-site
3224

33-
2. Create a virtual environment to install dependencies.
34-
*I recommend venv as it is packaged with python.*
35-
(venv documentation here https://docs.python.org/3/library/venv.html)
36-
37-
```
38-
Example using venv (Windows)
25+
# Windows
3926

4027
$ python -m venv venv
4128
$ source venv/Scripts/activate
4229

43-
Example using venv (MacOS/Linux)
30+
# MacOS/Linux
4431

4532
$ python -m venv venv
4633
$ source venv/bin/activate
34+
```
35+
36+
If this succeeds, you should see (venv) or an indicator that you are in a virtual environment.
37+
38+
## Step 3 - Install Dependencies
4739

40+
`pip install -r requirements.txt`
41+
42+
## Step 4 - Set Environment Variables
43+
44+
In the same `back` directory, create an `.env` file and put environment variables into it. The bare minimum you will need to place inside of it is:
45+
46+
```bash
47+
MEETUP_GRAPHQL_URL="https://api.meetup.com/gql"
4848
```
4949

50-
After the above two lines, you should see (venv) or something similar in your terminal.
50+
## Step 5 - Check that the backend runs successfully
51+
52+
In `back`, run the command `uvicorn main:app --reload`
53+
54+
Side note: as the project grows, we may want to add other flags or commands to the above command. In order to avoid having to remember the command, there is also a `run.sh` script that can also optionally be run instead of `uvicorn main:app --reload`
5155

52-
3. While inside your virtual environment, run `pip install -r requirements.txt`
56+
Visit [http://127.0.0.1:8000/](http://127.0.0.1:8000/) from a browser or send a get request to the above URL. If you get a response with data
5357

54-
This will install everything needed to get the backend running. The core app consists of:
55-
- Pytest
56-
- FastAPI
57-
- uvicorn
58-
- psycopg2
59-
- sqlmodel
60-
- dotenv
58+
```bash
59+
{
60+
Hello: "World"
61+
}
62+
```
6163

62-
Everything else seen in requirements.txt are dependencies of the above.
64+
You have successfully got the backend up and running. You may now begin contributing to the backend.
6365

64-
3. Install the appropriate code formatter. See `Tools` above for the formatter we use.
66+
# Setting up the Frontend
6567

66-
4. Set an .env file. The app will not run without this. It is not stored in source control for security reasons. Please see `back/readme.md` for more information.
68+
## Step 1 - Install Front Dependencies
6769

68-
## Running the App (Backend)
70+
Move to the front directory and run `npm install`
6971

70-
`uvicorn main:app --reload`
72+
```bash
73+
$ cd front
74+
$ npm install
75+
```
7176

72-
## Checking to see that the app works as intended (Back)
77+
This will produce a `node_modules` directory with all dependencies.
7378

74-
Please complete the above steps before moving here.
79+
## Step 2 - Run the project in dev mode
7580

76-
Visit `http://127.0.0.1:8000` and you should see {"Hello": "World"} as a JSON response. If you do not, please ask the Python Society group for troubleshooting help.
81+
`npm run dev`
7782

78-
If you have gotten this far, then your backend has been set up for development.
83+
To check that the project runs successfully, go to [`http://localhost:3000/`](http://localhost:3000/)
7984

80-
## Seeing the endpoints
85+
## Finished
8186

82-
`http://127.0.0.1:8000/docs`
87+
The frontend and backend are successfully connected if there is meetup event information at the bottom of the page. It should be viewable even if you are running both the back and frontend locally.
8388

84-
^ Provided by Swagger UI
89+
You are now ready to begin developing on this project.
8590

86-
## Alternative API docs
91+
The `production` branch is the live production version of the site. When making changes and adding features, be sure to create a branch from `production`.
8792

88-
`http://127.0.0.1:8000/redoc`
93+
## Extra Information
8994

95+
## Tools Used in Development
9096

97+
Language: Python 3.10
98+
Libraries: FastAPI
99+
Database: Postgres (version to be determined) (10/29 currently not in use, installation not required)
100+
Formatter: Black 22.8.0
101+
Testing: PyTest
102+
Front: JavaScript, Reactjs, Nextjs
103+
104+
## Frontend
105+
The frontend is compiled and bundled with Nextjs from a barebones template design.
106+
107+
## Branch Information
91108

109+
- production
110+
This is the production branch. Changes to this branch will ultimately affect the live site. It is currently locked down and must be modified via pull requests. A PR will trigger a github actions CI CD script where a build test happens. If build succeeds, merging to production is possible. Upon merge, another CI CD script takes the production bundle and uploads it to the live server.
92111

93-
## Setting Up the Environment (Front)
94-
Create a .env.local file at `/front` and add `MEETUP_URL=http://localhost:8000` to the environment file.
112+
- dev
113+
As of 11/16/2022 there is no staging environment. I suppose the site won't get so complicated as to need both staging and production, however, things may change in the near future depending on how we want to evolve the web application.
95114

96-
The app will not work without being able to access the MEETUP_URL endpoint.
115+
## Viewing the endpoints
97116

98-
From the /front directory run `npm install`
117+
`http://127.0.0.1:8000/docs`
99118

100-
## Running the App (Front)
101-
For development, run `npm run dev`
102119

103-
Then visit `http://localhost:3000` and verify that the page successfully loads.
120+
## Alternative API docs
104121

105-
The frontend and backend are successfully connected if there is meetup event information at the bottom of the page.
122+
`http://127.0.0.1:8000/redoc`

‎requirements.txt

+4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
anyio==3.6.1
2+
certifi==2022.9.24
3+
charset-normalizer==2.1.1
24
click==8.1.3
35
colorama==0.4.5
46
fastapi==0.82.0
@@ -8,9 +10,11 @@ idna==3.3
810
pydantic==1.10.2
911
python-dotenv==0.21.0
1012
PyYAML==6.0
13+
requests==2.28.1
1114
sniffio==1.3.0
1215
starlette==0.19.1
1316
typing_extensions==4.3.0
17+
urllib3==1.26.12
1418
uvicorn==0.18.3
1519
watchfiles==0.16.1
1620
websockets==10.3

0 commit comments

Comments
 (0)
Please sign in to comment.