-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4243f94
commit 28ef8c4
Showing
23 changed files
with
1,265 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# backend | ||
|
||
My Django Cookiecutter Template | ||
|
||
[![Built with Cookiecutter Django](https://img.shields.io/badge/built%20with-Cookiecutter%20Django-ff69b4.svg?logo=cookiecutter)](https://github.com/cookiecutter/cookiecutter-django/) | ||
[![Black code style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black) | ||
|
||
License: MIT | ||
|
||
## Settings | ||
|
||
Moved to [settings](http://cookiecutter-django.readthedocs.io/en/latest/settings.html). | ||
|
||
|
||
### Project Goals | ||
|
||
* Use Django admin site to import data from different sources (CSV, JSON, ...) into the database. | ||
|
||
* Use the power of Folium to visualize data generated from Django Database on a Leaflet JS map. | ||
|
||
* Visualize data using Folium's Simple Markers. | ||
|
||
* Authenticated users can import or export data using django forms. | ||
|
||
|
||
|
||
### To get started with this project | ||
|
||
* Make sure that Docker and docker-compose are installed in your system. | ||
|
||
* Clone the repository: git clone https://github.com/MoustafaShaaban/Advanced_Django_Blog.git | ||
|
||
* Change directory to backend directory ``` cd backend ``` | ||
|
||
* Build the docker image to develop the project locally using docker-compose: | ||
|
||
``` docker-compose -f local.yml build ``` | ||
|
||
* Create the database by running the following commands: | ||
|
||
` docker-compose -f local.yml run --rm django python manage.py migrate ` | ||
|
||
* Create a super user: | ||
|
||
` docker-compose -f local.yml run --rm django python manage.py createsuperuser ` | ||
|
||
* Now run the project: | ||
|
||
``` docker-compose -f local.yml up ``` | ||
|
||
|
||
* Open the web browser and go to ` http://localhost:8000/ ` to see the results. | ||
|
||
|
||
For more information about the available commands in this project check the Cookiecutter Django [Documentation](https://cookiecutter-django.readthedocs.io/en/latest/developing-locally-docker.html#build-the-stack) | ||
|
||
|
||
|
||
|
||
|
||
### Docker | ||
|
||
See detailed [cookiecutter-django Docker documentation](http://cookiecutter-django.readthedocs.io/en/latest/deployment-with-docker.html). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from rest_framework import serializers | ||
|
||
from geoapp.models import Feature | ||
|
||
|
||
class FeatureSerializer(serializers.ModelSerializer): | ||
class Meta: | ||
model = Feature | ||
fields = ["name", "type", "description", "latitude", "longitude", "url"] | ||
|
||
extra_kwargs = { | ||
"url": {"view_name": "api:feature-detail", "lookup_field": "id"} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from django.contrib.auth import get_user_model | ||
from rest_framework import status | ||
from rest_framework.decorators import action | ||
from rest_framework.mixins import ListModelMixin, RetrieveModelMixin, UpdateModelMixin | ||
from rest_framework.response import Response | ||
from rest_framework.viewsets import GenericViewSet | ||
|
||
from .serializers import FeatureSerializer | ||
from geoapp.models import Feature | ||
|
||
User = get_user_model() | ||
|
||
|
||
class FeatureViewSet(RetrieveModelMixin, ListModelMixin, UpdateModelMixin, GenericViewSet): | ||
serializer_class = FeatureSerializer | ||
queryset = Feature.objects.all() | ||
lookup_field = "id" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
.env | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Vue 3 + Vite | ||
|
||
This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more. | ||
|
||
## Recommended IDE Setup | ||
|
||
- [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Vite + Vue</title> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<script type="module" src="/src/main.js"></script> | ||
</body> | ||
</html> |
Oops, something went wrong.