forked from ao994/plant-pals
-
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.
Merge pull request #1 from ak2466/alex-development
Update workflow
- Loading branch information
Showing
260 changed files
with
2,151 additions
and
1,320 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Docker Image CI | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build_and_publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout the repository | ||
uses: actions/checkout@v4 | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- | ||
name: Log into GHCR | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{secrets.GH_USERNAME}} | ||
password: ${{secrets.GH_PAT}} | ||
- | ||
name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: Code/. | ||
push: true | ||
tags: ghcr.io/ak2466/plantpals:latest | ||
|
||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: SSH | ||
uses: appleboy/ssh-action@v1.0.3 | ||
with: | ||
host: ${{ secrets.HOST }} | ||
username: ${{ secrets.SERVER_USERNAME }} | ||
key: ${{ secrets.SSH_KEY }} | ||
port: ${{ secrets.SSH_PORT }} | ||
script: | | ||
docker ps -aq | xargs docker stop | xargs docker rm | ||
docker rmi -f $(docker images -aq) | ||
service docker restart | ||
docker pull ghcr.io/ak2466/plantpals:latest | ||
docker run -d ${{secrets.DB_VOLUME}} |
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 |
---|---|---|
@@ -1,6 +1,11 @@ | ||
/db.sqlite3 | ||
/Forum/__pycache__/** | ||
/profile_of_user/__pycache__/** | ||
/profile_of_user/migrations/** | ||
/.venv/** | ||
**db.sqlite3** | ||
**__pycache__** | ||
**migrations/** | ||
**.DS_Store** | ||
**djangoenv/** | ||
/db/db.sqlite3 | ||
**/Forum/__pycache__/** | ||
**/profile_of_user/__pycache__/** | ||
**/profile_of_user/migrations/** | ||
**/.venv/** | ||
plant-pals/db.sqlite3 |
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,51 @@ | ||
## Code of Conduct | ||
|
||
### Our Pledge | ||
|
||
We want the environment of our project to remain friendly and comfortable for | ||
all involved. As such, there may be no harassment of any kind (age, body, | ||
disability, ethnicity, gender identity and expression, level of experience, | ||
nationality, personal appearance, race, religion, or sexual identity and | ||
orientation) permitted in any project space or materials. Also, every member | ||
of the team is expected to do their part and contribute appropriately to the | ||
project. | ||
|
||
### Our Standards | ||
|
||
Behaviors that are expected of participants include: | ||
|
||
* Listening to suggestions from other team members | ||
* Giving criticism kindly and constructively | ||
* Being friendly towards other members of the team | ||
* Supporting other team members when needed | ||
* Completing work in a timely fashion | ||
* Turning in work that is high quality | ||
|
||
Behaviors that are unacceptable include: | ||
|
||
* Insulting or being unkind toward other team members | ||
* Producing work that has little time and effort put into it | ||
* Being behind on work without communicating these difficulties to the team | ||
|
||
### Scope | ||
|
||
This Code of Conduct applies both within project meeting spaces, class, the discord, | ||
and within the materials made for this project. If circumstances outside of these | ||
arise, the group will discuss together to decide on the appropriate response. | ||
|
||
### Enforcement | ||
|
||
Any behavior that violates the code of conduct will be discussed | ||
in the Monday meetings so that the team may decide on how best to move | ||
forward and find an understanding of the root of the issue. If the problem | ||
needs to be addressed more immediately, it will be brought up in the | ||
'general' tab of the discord and a virtual meeting will be set up and held | ||
to tackle the issue. | ||
|
||
### Attribution | ||
|
||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, | ||
available at [http://contributor-covenant.org/version/1/4][version] | ||
|
||
[homepage]: http://contributor-covenant.org | ||
[version]: http://contributor-covenant.org/version/1/4/ |
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,21 @@ | ||
# Contributing | ||
|
||
Hello, welcome to the Plant Pals project! | ||
|
||
This repository is only to be contibuted to be project members, who will make pull requests | ||
from their branches that must be reviewed by another member before the change is made. | ||
|
||
When contributing to the project, please follow the code of conduct. | ||
|
||
## Pull Request Process | ||
|
||
1. Pull requests may be made by any member of the team. | ||
2. Changes should be initially made on the team members updated personal branch. | ||
3. Once these changes are made and tested, create a pull request to merge with the main branch. | ||
4. One other member of the team must approve the pull request before the changes are made. | ||
5. There must always be a backup version of the repository in case of a change breaking the website. | ||
|
||
## Issues | ||
|
||
Any ideas for features that should be added, bugs found, or areas of the website that need improvement should be opened in github as issues. | ||
We will address these issues over the course of the project based on priority. |
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,14 @@ | ||
FROM python:3.12-alpine | ||
|
||
WORKDIR /usr/src/app | ||
|
||
ENV PYTHONDONTWRITEBYTECODE 1 | ||
ENV PYTHONUNBUFFERED 1 | ||
|
||
RUN pip install --upgrade pip | ||
|
||
COPY . /usr/src/app/. | ||
|
||
RUN pip install --no-cache-dir -r requirements.txt | ||
|
||
CMD /usr/src/app/entrypoint.sh |
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 @@ | ||
version: '3.8' | ||
|
||
services: | ||
django: | ||
container_name: django | ||
build: | ||
context: ./ | ||
ports: | ||
- 80:80 | ||
platform: linux/amd64 | ||
volumes: | ||
- ./db:/usr/src/app/db | ||
image: ghcr.io/ak2466/plantpals:latest |
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 @@ | ||
#!/bin/ash | ||
|
||
echo "Changing directory" | ||
cd plant-pals | ||
|
||
echo "Apply database migrations" | ||
python manage.py migrate | ||
|
||
echo "Starting server" | ||
python manage.py runserver 0.0.0.0:80 | ||
|
||
exec "$@" | ||
|
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
File renamed without changes.
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
File renamed without changes.
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,98 @@ | ||
from django.db import models | ||
from django.contrib.auth.models import User | ||
from django.utils.timezone import now | ||
from django.db.models import UniqueConstraint # Constrains fields to unique values | ||
|
||
# profile model | ||
class Profile(models.Model): | ||
user = models.OneToOneField(User, null=True, blank=True, on_delete=models.CASCADE) | ||
# for user avatar images | ||
avatar = models.ImageField(upload_to="images", default="default/user.png") | ||
|
||
## for the plants. If more portfolio plants are wanted, copy and past this | ||
## just remember to change the name, add it to the PlantForm class in forms.py, | ||
## adjust views.py to allow for another plant submission, and add it to | ||
## the profile html page. | ||
|
||
# change default to a temp plant when we have one | ||
plant_image_1 = models.ImageField(upload_to="additional_images", default="default/user.png") | ||
plant_name_1 = models.CharField(max_length=60, default="") | ||
|
||
#makes sure the images are deleted when a profile is deleted | ||
def delete(self, using=None, keep_parents=False): | ||
self.avatar.delete() | ||
self.plant_image_1.delete() | ||
super().delete() | ||
|
||
# post model | ||
class Post(models.Model): | ||
user1 = models.ForeignKey(User, on_delete=models.CASCADE, default=1) | ||
post_id = models.AutoField | ||
post_content = models.CharField(max_length=5000) | ||
timestamp= models.DateTimeField(default=now) | ||
image = models.ImageField(upload_to="images",default="") | ||
|
||
#makes sure the image is deleted when a post is deleted | ||
def delete(self, using=None, keep_parents=False): | ||
self.image.delete() | ||
super().delete() | ||
|
||
# reply model (associated with post) | ||
class Replie(models.Model): | ||
user = models.ForeignKey(User, on_delete=models.CASCADE, default=1) | ||
reply_id = models.AutoField | ||
reply_content = models.CharField(max_length=5000) | ||
post = models.ForeignKey(Post, on_delete=models.CASCADE, default='') | ||
timestamp= models.DateTimeField(default=now) | ||
image = models.ImageField(upload_to="images",default="") | ||
|
||
# makes sure the image is deleted when a reply is deleted | ||
def delete(self, using=None, keep_parents=False): | ||
self.image.delete() | ||
super().delete() | ||
|
||
### model for plant watering schedule | ||
class DailyTask(models.Model): | ||
user = models.ForeignKey(User, on_delete=models.CASCADE) | ||
task_date = models.DateField() | ||
task_description = models.CharField(max_length=100) | ||
completed = models.BooleanField(default=False) | ||
|
||
class Meta: | ||
unique_together = ('user', 'task_date') | ||
|
||
############################################################################## | ||
# Plant data entry model | ||
############################################################################## | ||
class Plant(models.Model): | ||
"""This model is for entering plants into the database.""" | ||
|
||
#Fields | ||
scientific_name = models.CharField("scientific name", max_length = 100, unique = True) | ||
common_name = models.CharField("common name", max_length = 50) | ||
growth_habit = models.CharField("growth habit", max_length = 20) | ||
duration = models.CharField("seasonal duration", max_length = 20) | ||
sun_requirements = models.CharField("sun requirements", max_length = 20) | ||
water = models.CharField("water recommended", max_length = 50) | ||
temp_low_F = models.FloatField("lowest temperature (F)", max_length = 5) | ||
temp_high_F = models.FloatField("highest temperature (F)", max_length = 5) | ||
image = models.ImageField("plant image", upload_to="plant_database",default="") | ||
|
||
#ordering of plants | ||
class Meta: | ||
ordering = ['scientific_name'] | ||
|
||
#methods | ||
def __str__(self): | ||
return self.scientific_name | ||
|
||
#makes sure the image is deleted when a plant is deleted | ||
def delete(self, using=None, keep_parents=False): | ||
self.image.delete() | ||
super().delete() | ||
|
||
############################################################################## | ||
# Search function model | ||
############################################################################## | ||
|
||
|
Oops, something went wrong.