Skip to content

Commit

Permalink
Merge pull request #2 from PostHog/connect-python
Browse files Browse the repository at this point in the history
Prepare TS to connect to Python
  • Loading branch information
paolodamico authored Dec 28, 2021
2 parents d98922d + 786b27d commit ac3315c
Show file tree
Hide file tree
Showing 38 changed files with 10,961 additions and 3,308 deletions.
5 changes: 5 additions & 0 deletions .kearc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"tsConfigPath": "./tsconfig.json",
"rootPath": "./src",
"typesPath": "./src"
}
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

The code for the server is located in the [`backend`](./backend) directory.

**Install dependencies**
### 1. Install dependencies**

1. Install [Postgres.app](https://postgresapp.com/) and follow the [instructions](https://postgresapp.com/documentation/install.html) to add it to your path.

Expand All @@ -24,7 +24,8 @@ export GDAL_LIBRARY_PATH=/opt/homebrew/lib/libgdal.dylib
export GEOS_LIBRARY_PATH=/opt/homebrew/lib/libgeos_c.dylib
```

**Create database & Role**
### 2. Create database and start backend

```
psql
CREATE DATABASE whereintheworld;
Expand All @@ -40,15 +41,14 @@ python manage.py cities --import=all
python manage.py runserver
```

The server is now running at [`http://localhost:3001/`](http://localhost:3001/).
The server is now running at [`http://localhost:8000/`](http://localhost:8000/).

### 3. Start the app (frontend)
### 3. Start the frontend

The code for the Next.js app is located in the [`frontend`](./frontend) directory. Once you launched the server, you can start it as follows:
The code for the frontend is located in the [`src`](./src) directory. Once you launched the server, you can start it as follows:

```
cd ../frontend
yarn install
yarn
yarn start
```

Expand Down
8 changes: 6 additions & 2 deletions backend/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,17 @@
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.2/howto/static-files/


STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles")
STATIC_URL = "/static/"
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "build/"),
]

# TODO: Temporary
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": ["frontend/dist", "backend/templates"],
"DIRS": ["build", "backend/templates"],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
Expand Down
2 changes: 1 addition & 1 deletion backend/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
<title>Where in the world!</title>
</head>
<html>
TODO: This is a temporary file while the frontend gets ported to Python.
TODO: This is a temporary file while the frontend gets properly connected to Django.
</html>
37 changes: 0 additions & 37 deletions frontend/components/TimeTravel.tsx

This file was deleted.

6 changes: 0 additions & 6 deletions frontend/next-env.d.ts

This file was deleted.

9 changes: 0 additions & 9 deletions frontend/next.config.js

This file was deleted.

47 changes: 0 additions & 47 deletions frontend/package.json

This file was deleted.

30 changes: 0 additions & 30 deletions frontend/pages/_app.tsx

This file was deleted.

29 changes: 0 additions & 29 deletions frontend/tsconfig.json

This file was deleted.

Loading

0 comments on commit ac3315c

Please sign in to comment.