diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml new file mode 100644 index 0000000..563b87d --- /dev/null +++ b/.github/workflows/ruff.yml @@ -0,0 +1,8 @@ +name: Ruff +on: [push, pull_request] +jobs: + ruff: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: chartboost/ruff-action@v1 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b1a1554..f575616 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,23 +1,18 @@ -name: Test -on: - - push - - pull_request +name: Django Test +on: [push, pull_request] jobs: test: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest] - python-version: ["3.10"] + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + - name: Checkout code + uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v3 with: - python-version: ${{ matrix.python-version }} + python-version: "3.10" - name: Install dependencies run: | python -m pip install --upgrade pip - pip install tox tox-gh-actions - - name: Test with tox - run: tox + pip install -r requirements.txt + - name: Run tests + run: python manage.py test diff --git a/FOSSDB_web/__init__.py b/FOSSDB/__init__.py similarity index 100% rename from FOSSDB_web/__init__.py rename to FOSSDB/__init__.py diff --git a/FOSSDB_web/apps/account/__init__.py b/FOSSDB/apps/account/__init__.py similarity index 100% rename from FOSSDB_web/apps/account/__init__.py rename to FOSSDB/apps/account/__init__.py diff --git a/FOSSDB_web/apps/account/admin.py b/FOSSDB/apps/account/admin.py similarity index 100% rename from FOSSDB_web/apps/account/admin.py rename to FOSSDB/apps/account/admin.py diff --git a/FOSSDB_web/apps/account/apps.py b/FOSSDB/apps/account/apps.py similarity index 100% rename from FOSSDB_web/apps/account/apps.py rename to FOSSDB/apps/account/apps.py diff --git a/FOSSDB_web/apps/account/forms.py b/FOSSDB/apps/account/forms.py similarity index 100% rename from FOSSDB_web/apps/account/forms.py rename to FOSSDB/apps/account/forms.py diff --git a/FOSSDB_web/apps/account/tests.py b/FOSSDB/apps/account/tests.py similarity index 100% rename from FOSSDB_web/apps/account/tests.py rename to FOSSDB/apps/account/tests.py diff --git a/FOSSDB_web/apps/account/urls.py b/FOSSDB/apps/account/urls.py similarity index 100% rename from FOSSDB_web/apps/account/urls.py rename to FOSSDB/apps/account/urls.py diff --git a/FOSSDB_web/apps/account/views.py b/FOSSDB/apps/account/views.py similarity index 100% rename from FOSSDB_web/apps/account/views.py rename to FOSSDB/apps/account/views.py diff --git a/FOSSDB_web/apps/fossdb/__init__.py b/FOSSDB/apps/fossdb/__init__.py similarity index 100% rename from FOSSDB_web/apps/fossdb/__init__.py rename to FOSSDB/apps/fossdb/__init__.py diff --git a/FOSSDB_web/apps/fossdb/admin.py b/FOSSDB/apps/fossdb/admin.py similarity index 100% rename from FOSSDB_web/apps/fossdb/admin.py rename to FOSSDB/apps/fossdb/admin.py diff --git a/FOSSDB_web/apps/fossdb/apps.py b/FOSSDB/apps/fossdb/apps.py similarity index 100% rename from FOSSDB_web/apps/fossdb/apps.py rename to FOSSDB/apps/fossdb/apps.py diff --git a/FOSSDB_web/apps/fossdb/forms.py b/FOSSDB/apps/fossdb/forms.py similarity index 100% rename from FOSSDB_web/apps/fossdb/forms.py rename to FOSSDB/apps/fossdb/forms.py diff --git a/FOSSDB_web/apps/fossdb/host/forms.py b/FOSSDB/apps/fossdb/host/forms.py similarity index 100% rename from FOSSDB_web/apps/fossdb/host/forms.py rename to FOSSDB/apps/fossdb/host/forms.py diff --git a/FOSSDB_web/apps/fossdb/host/models.py b/FOSSDB/apps/fossdb/host/models.py similarity index 100% rename from FOSSDB_web/apps/fossdb/host/models.py rename to FOSSDB/apps/fossdb/host/models.py diff --git a/FOSSDB_web/apps/fossdb/language/forms.py b/FOSSDB/apps/fossdb/language/forms.py similarity index 100% rename from FOSSDB_web/apps/fossdb/language/forms.py rename to FOSSDB/apps/fossdb/language/forms.py diff --git a/FOSSDB_web/apps/fossdb/language/models.py b/FOSSDB/apps/fossdb/language/models.py similarity index 100% rename from FOSSDB_web/apps/fossdb/language/models.py rename to FOSSDB/apps/fossdb/language/models.py diff --git a/FOSSDB_web/apps/fossdb/license/forms.py b/FOSSDB/apps/fossdb/license/forms.py similarity index 100% rename from FOSSDB_web/apps/fossdb/license/forms.py rename to FOSSDB/apps/fossdb/license/forms.py diff --git a/FOSSDB_web/apps/fossdb/license/models.py b/FOSSDB/apps/fossdb/license/models.py similarity index 100% rename from FOSSDB_web/apps/fossdb/license/models.py rename to FOSSDB/apps/fossdb/license/models.py diff --git a/FOSSDB_web/apps/fossdb/migrations/0001_initial.py b/FOSSDB/apps/fossdb/migrations/0001_initial.py similarity index 100% rename from FOSSDB_web/apps/fossdb/migrations/0001_initial.py rename to FOSSDB/apps/fossdb/migrations/0001_initial.py diff --git a/FOSSDB_web/apps/fossdb/migrations/0002_operatingsystem_project_os.py b/FOSSDB/apps/fossdb/migrations/0002_operatingsystem_project_os.py similarity index 100% rename from FOSSDB_web/apps/fossdb/migrations/0002_operatingsystem_project_os.py rename to FOSSDB/apps/fossdb/migrations/0002_operatingsystem_project_os.py diff --git a/FOSSDB_web/apps/fossdb/migrations/0003_star_project_star.py b/FOSSDB/apps/fossdb/migrations/0003_star_project_star.py similarity index 100% rename from FOSSDB_web/apps/fossdb/migrations/0003_star_project_star.py rename to FOSSDB/apps/fossdb/migrations/0003_star_project_star.py diff --git a/FOSSDB_web/apps/fossdb/migrations/__init__.py b/FOSSDB/apps/fossdb/migrations/__init__.py similarity index 100% rename from FOSSDB_web/apps/fossdb/migrations/__init__.py rename to FOSSDB/apps/fossdb/migrations/__init__.py diff --git a/FOSSDB_web/apps/fossdb/models.py b/FOSSDB/apps/fossdb/models.py similarity index 70% rename from FOSSDB_web/apps/fossdb/models.py rename to FOSSDB/apps/fossdb/models.py index 53d1bd0..5f19875 100644 --- a/FOSSDB_web/apps/fossdb/models.py +++ b/FOSSDB/apps/fossdb/models.py @@ -14,13 +14,16 @@ User = settings.AUTH_USER_MODEL class Project(models.Model): - uuid = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) + uuid = models.UUIDField( + primary_key=True, default=uuid.uuid4, editable=False) author = models.ForeignKey(User, on_delete=models.CASCADE, db_index=True) name = models.CharField(max_length=255) description = models.TextField(blank=True, default="") licenses = models.ManyToManyField(License) - programming_languages = models.ManyToManyField(ProgrammingLanguage, through="ProjectProgrammingLanguage", related_name="projects") - hosting_platform = models.ManyToManyField(HostingPlatform, through="ProjectHostingPlatform", related_name="projects") + programming_languages = models.ManyToManyField( + ProgrammingLanguage, through="ProjectProgrammingLanguage", related_name="projects") + hosting_platform = models.ManyToManyField( + HostingPlatform, through="ProjectHostingPlatform", related_name="projects") tag = models.ManyToManyField(Tag) os = models.ManyToManyField(OperatingSystem) star = models.ManyToManyField(Star, related_name="projects_star") @@ -38,5 +41,6 @@ class Project(models.Model): def save(self, *args, **kwargs): if not self.uuid: - self.uuid = uuid.uuid3(uuid.uuid4(), f"{self.author.username}-{self.name}") + self.uuid = uuid.uuid3( + uuid.uuid4(), f"{self.author.username}-{self.name}") super().save(*args, **kwargs) diff --git a/FOSSDB_web/apps/fossdb/operating_system/models.py b/FOSSDB/apps/fossdb/operating_system/models.py similarity index 100% rename from FOSSDB_web/apps/fossdb/operating_system/models.py rename to FOSSDB/apps/fossdb/operating_system/models.py diff --git a/FOSSDB_web/apps/fossdb/star/models.py b/FOSSDB/apps/fossdb/star/models.py similarity index 100% rename from FOSSDB_web/apps/fossdb/star/models.py rename to FOSSDB/apps/fossdb/star/models.py diff --git a/FOSSDB_web/apps/fossdb/tag/models.py b/FOSSDB/apps/fossdb/tag/models.py similarity index 100% rename from FOSSDB_web/apps/fossdb/tag/models.py rename to FOSSDB/apps/fossdb/tag/models.py diff --git a/FOSSDB_web/apps/fossdb/tests.py b/FOSSDB/apps/fossdb/tests.py similarity index 100% rename from FOSSDB_web/apps/fossdb/tests.py rename to FOSSDB/apps/fossdb/tests.py diff --git a/FOSSDB_web/apps/fossdb/urls.py b/FOSSDB/apps/fossdb/urls.py similarity index 100% rename from FOSSDB_web/apps/fossdb/urls.py rename to FOSSDB/apps/fossdb/urls.py diff --git a/FOSSDB_web/apps/fossdb/views.py b/FOSSDB/apps/fossdb/views.py similarity index 100% rename from FOSSDB_web/apps/fossdb/views.py rename to FOSSDB/apps/fossdb/views.py diff --git a/FOSSDB_web/asgi.py b/FOSSDB/asgi.py similarity index 73% rename from FOSSDB_web/asgi.py rename to FOSSDB/asgi.py index e090765..11a6b23 100644 --- a/FOSSDB_web/asgi.py +++ b/FOSSDB/asgi.py @@ -1,5 +1,5 @@ """ -ASGI config for FOSSDB_web project. +ASGI config for FOSSDB project. It exposes the ASGI callable as a module-level variable named ``application``. @@ -11,6 +11,6 @@ import os from django.core.asgi import get_asgi_application -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "FOSSDB_web.settings") +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "FOSSDB.settings") application = get_asgi_application() diff --git a/FOSSDB_web/settings.py b/FOSSDB/settings.py similarity index 95% rename from FOSSDB_web/settings.py rename to FOSSDB/settings.py index 0c10737..39ae324 100644 --- a/FOSSDB_web/settings.py +++ b/FOSSDB/settings.py @@ -1,5 +1,5 @@ """ -Django settings for FOSSDB_web project. +Django settings for FOSSDB project. Generated by "django-admin startproject" using Django 4.0.5. @@ -16,7 +16,7 @@ from pathlib import Path # Build paths inside the project like this: BASE_DIR / "subdir". BASE_PATH = Path(__file__).resolve().parent.parent -sys.path.insert(0, str(BASE_PATH.joinpath("FOSSDB_web", "apps"))) +sys.path.insert(0, str(BASE_PATH.joinpath("FOSSDB", "apps"))) # SECURITY WARNING: don't run with debug turned on in production! @@ -56,7 +56,7 @@ MIDDLEWARE = [ "django.middleware.clickjacking.XFrameOptionsMiddleware", ] -ROOT_URLCONF = "FOSSDB_web.urls" +ROOT_URLCONF = "FOSSDB.urls" TEMPLATES = [ { @@ -74,7 +74,7 @@ TEMPLATES = [ }, ] -WSGI_APPLICATION = "FOSSDB_web.wsgi.application" +WSGI_APPLICATION = "FOSSDB.wsgi.application" # Database diff --git a/FOSSDB_web/urls.py b/FOSSDB/urls.py similarity index 96% rename from FOSSDB_web/urls.py rename to FOSSDB/urls.py index a68021a..6618184 100644 --- a/FOSSDB_web/urls.py +++ b/FOSSDB/urls.py @@ -1,4 +1,4 @@ -"""FOSSDB_web URL Configuration +"""FOSSDB URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/4.0/topics/http/urls/ diff --git a/FOSSDB_web/wsgi.py b/FOSSDB/wsgi.py similarity index 73% rename from FOSSDB_web/wsgi.py rename to FOSSDB/wsgi.py index 3d462f8..db8157c 100644 --- a/FOSSDB_web/wsgi.py +++ b/FOSSDB/wsgi.py @@ -1,5 +1,5 @@ """ -WSGI config for FOSSDB_web project. +WSGI config for FOSSDB project. It exposes the WSGI callable as a module-level variable named ``application``. @@ -11,6 +11,6 @@ import os from django.core.wsgi import get_wsgi_application -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "FOSSDB_web.settings") +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "FOSSDB.settings") application = get_wsgi_application() diff --git a/README.md b/README.md new file mode 100644 index 0000000..0524bad --- /dev/null +++ b/README.md @@ -0,0 +1,52 @@ +# FOSSDB + +[![License](https://img.shields.io/badge/license-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0.en.html) +![Django Test](https://github.com/kristoferssolo/FOSSDB/actions/workflows/test.yml/badge.svg) +![Ruff](https://github.com/kristoferssolo/FOSSDB/actions/workflows/ruff.yml/badge.svg) + + +FOSSDB is an open-source web application that helps users find, contribute, and collaborate on free and open-source software (FOSS) projects. + +## Table of Contents +- [Installation](#installation) +- [Usage](#usage) +- [Contributing](#contributing) +- [License](#license) + +## Installation +1. Clone the repository and `cd` into it. +2. Install dependencies: +```sh +pip install -r requirements.txt +``` +3. Enter your `SECRET_KEY` and database information into `config.json` file. +4. Run database migrations: +```sh +python manage.py migrate +``` +5. Create a superuser: +```sh +python manage.py createsuperuser +``` +6. Run the development server: +```sh +python manage.py runserver +``` + +## Usage +After following the installation steps, you can access the application at [https://localhost:8000](https://localhost:8000). +Here are some of the features: +- Browse projects by programming language, license, or search term +- View project details, including programming languages, licenses, and descriptions +- Create a new project and add programming languages and licenses +- Edit and delete existing projects + +## Contributing +Contributions are always welcome! Here are some ways to get started: +1. Fork the repository and make your changes. +2. Submit a pull request. +3. Respond to open issues or submit new ones. +4. Improve documentation. + +## License +This project is licensed under the [GPL3 License](https://www.gnu.org/licenses/gpl-3.0.en.html). See the [LICENSE](./LICENSE) file for details. diff --git a/manage.py b/manage.py index 94b8cd0..00cee50 100755 --- a/manage.py +++ b/manage.py @@ -6,7 +6,7 @@ import sys def main(): """Run administrative tasks.""" - os.environ.setdefault("DJANGO_SETTINGS_MODULE", "FOSSDB_web.settings") + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "FOSSDB.settings") try: from django.core.management import execute_from_command_line except ImportError as exc: diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 3ef6ae0..0000000 --- a/setup.cfg +++ /dev/null @@ -1,35 +0,0 @@ -[metadata] -name = FOSSDB-Web -description = Open-Source Software Database Website -author = Kristofers Solo -license = GPL3 -license_files = LICENSE -platforms = unix, linux, osx, cygwin, win32 -classifiers = - Programming Language :: Python :: 3.10 - -[options] -packages = FOSSDB_web -install_requires = - Django>=4.1 - Pillow>=9.4.0 - fontawesomefree>=6.2.1 - mysqlclient>=2.1.1 - -python_requires = >=3.10 -package_dir = =. -zip_safe = no - -[options.extras_require] -testing = - flake8>=6.0.0 - mypy>=0.991 - pytest-cov>=4.0.0 - pytest>=7.2.0 - tox>=3.27.1 - -[options.package_data] -detector = py.typed - -[flake8] -max-line-length = 160 diff --git a/setup.py b/setup.py deleted file mode 100644 index 7f1a176..0000000 --- a/setup.py +++ /dev/null @@ -1,4 +0,0 @@ -from setuptools import setup - -if __name__ == "__main__": - setup() diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 0e5c0d3..0000000 --- a/tox.ini +++ /dev/null @@ -1,25 +0,0 @@ -[tox] -minversion = 3.8.0 -envlist = django, flake8, mypy -isolated_build = true - -[gh-actions] -python = - 3.10: django, mypy, flake8 - - -[testenv:django] -basepython = python3.10 -deps = django -commands = python manage.py test - -[testenv:flake8] -basepython = python3.10 -deps = flake8 -commands = flake8 FOSSDB_web - -[testenv:mypy] -basepython = python3.10 -deps = - -r{toxinidir}/requirements_dev.txt -commands = mypy FOSSDB_web