{"id":26397260,"url":"https://github.com/timalexanderandersson/personal-webpage-v1","last_synced_at":"2025-03-17T12:17:14.060Z","repository":{"id":275787306,"uuid":"927177633","full_name":"Timalexanderandersson/personal-webpage-v1","owner":"Timalexanderandersson","description":"Personal webpage for project and CV","archived":false,"fork":false,"pushed_at":"2025-02-18T17:38:33.000Z","size":1957,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-18T18:41:04.371Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Timalexanderandersson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-04T14:35:22.000Z","updated_at":"2025-02-18T17:38:36.000Z","dependencies_parsed_at":"2025-02-18T18:27:39.637Z","dependency_job_id":"d4e5a92f-a7cf-4615-92ce-82ee07fa2246","html_url":"https://github.com/Timalexanderandersson/personal-webpage-v1","commit_stats":null,"previous_names":["timalexanderandersson/personal-webpage-v1"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Timalexanderandersson%2Fpersonal-webpage-v1","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Timalexanderandersson%2Fpersonal-webpage-v1/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Timalexanderandersson%2Fpersonal-webpage-v1/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Timalexanderandersson%2Fpersonal-webpage-v1/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Timalexanderandersson","download_url":"https://codeload.github.com/Timalexanderandersson/personal-webpage-v1/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244031151,"owners_count":20386534,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-17T12:17:13.184Z","updated_at":"2025-03-17T12:17:14.042Z","avatar_url":"https://github.com/Timalexanderandersson.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Backend API for v1\n\n## Description\nThis is a **Django REST** backend API. The backend API handles email functionality, allowing users to send messages via the contact feature on the website.\n\n\n\n## Technical Stack\n- **Backend**: Django REST Framework\n- **Version Control**: GitHub\n- **Deployment**: Backend on Heroku\n\n### Install Dependencies\n\n#### Install Django\n1. Install Django using pip:\n    ```bash\n    pip install django\n    ```\n\n2. Create a new Django project:\n    ```bash\n    django-admin startproject myproject\n    ```\n\n3. Navigate to the project directory:\n    ```bash\n    cd myproject\n    ```\n\n#### Set Up the Project\n1. Apply initial migrations:\n    ```bash\n    python manage.py migrate\n    ```\n\n2. Create a superuser:\n    ```bash\n    python manage.py createsuperuser\n    ```\n\n3. Run the development server:\n    ```bash\n    python manage.py runserver\n    ```\n\n#### Set Up the App for Sending Emails\n1. Create a new Django app:\n    ```bash\n    python manage.py startapp sending_email\n    ```\n\n2. Add the app to your project's `INSTALLED_APPS` in `settings.py`:\n    ```python\n    INSTALLED_APPS = [\n        ...\n        'sending_email',\n    ]\n    ```\n\n3. Configure email settings in `settings.py`:\n    ```python\n    EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'\n    EMAIL_HOST = 'smtp.example.com'\n    EMAIL_PORT = 587\n    EMAIL_USE_TLS = True\n    EMAIL_HOST_USER = 'your-email@example.com'\n    EMAIL_HOST_PASSWORD = 'your-email-password'\n    ```\n\n4. Created a view to handle email sending in `sending_email/views.py`:\n\n\n5. Add a URL pattern for the email view in `sending_email/urls.py`:\n    ```python\n    from django.urls import path\n    from .views import send_email\n\n    urlpatterns = [\n        path('send-email/', send_email, name='send_email'),\n    ]\n    ```\n\n6. Include the app's URLs in the project's `urls.py`:\n    ```python\n    from django.urls import include, path\n\n    urlpatterns = [\n        ...\n        path('sending_email/', include('sending_email.urls')),\n    ]\n    ```\n    7. Created a serializers.py to handle json `sending_email/serializers.py`:\n\n    ## env.py file\n\n    ### this is what used in the file\n\n\nSpecify the front-end URL for API communication\n\nos.environ[\"MY_FRONTEND\"] = \"https://yourfrontend.com\"  \n\nAllowed domains that can make requests to your backend\n\nos.environ[\"ALLOWED_HOSTS\"] = \"localhost, .yourdomain.com\" \n\n\nEmail server username\n\nos.environ[\"EMAIL_HOST_USER\"] = \"your_email@example.com\" \n\nEmail server password\n\nos.environ[\"EMAIL_HOST_PASSWORD\"] = \"your_email_password\" \n\nDjango secret key used to secure data and sessions\n\nos.environ[\"SECRET_KEY\"] = \"your_secret_key\" \n\n\n\n## Deployment \nThe frontend is deployed on **Heroku**.\n\n- **Frontend**: [Link to live website](https://my-webpage-v1-react-c9cd915b1668.herokuapp.com)\n\n\n- **Backend**: [Link to GitHub repository](https://github.com/Timalexanderandersson/personal-webpage-v1)\n\n## Deployment to Heroku\n\n### Preparations\n1. Create an account on [Heroku](https://www.heroku.com/).\n2. Install [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli).\n\n### Create a Heroku app manually\n1. Log in to your Heroku account.\n2. Click on \"New\" and select \"Create new app\".\n3. Name your app `my-webpage-v1` and click \"Create app\".\n\n### Config vars in your settings in heroku\n#### same as in the env file\n\n\nSpecify the front-end URL for API communication\n\nos.environ[\"MY_FRONTEND\"] = \"https://yourfrontend.com\"  \n\nAllowed domains that can make requests to your backend\n\nos.environ[\"ALLOWED_HOSTS\"] = \"localhost, .yourdomain.com\" \n\nEmail server username\n\nos.environ[\"EMAIL_HOST_USER\"] = \"your_email@example.com\" \n\nEmail server password\n\nos.environ[\"EMAIL_HOST_PASSWORD\"] = \"your_email_password\" \n\nDjango secret key used to secure data and sessions\n\nos.environ[\"SECRET_KEY\"] = \"your_secret_key\" \n\nDisable automatic collectstatic on Heroku (useful for custom static handling)\n\nos.environ[\"DISABLE_COLLECTSTATIC\"] = \"1\" \n\n\n### Deploy the code manually\n1. Navigate to the \"Deploy\" tab in your Heroku app dashboard.\n2. Connect your GitHub repository.\n3. Select the branch you want to deploy and click \"Deploy Branch\".\n\n## Deploying to GitHub\n\n### Create a GitHub Repository\n1. Go to [GitHub](https://github.com/) and log in to your account.\n2. Click on the \"+\" icon in the top right corner and select \"New repository\".\n3. Name your repository `my-webpage-v1` and click \"Create repository\".\n\n### Push Code to GitHub\n1. Open your project in VSCode.\n2. Open a terminal in VSCode.\n3. Initialize a new Git repository:\n\n4. Add your files to the repository:\n        ```bash\n        git add .\n        ```\n5. Commit your changes:\n        ```bash\n        git commit -m \"Initial commit\"\n        ```\n7. Push your code to GitHub:\n        ```bash\n        git push \n        ```\n\n\n## Improvements\n\n- Add more validation for sending the email.\n\n\n## Installed Libraries\n\nThe following libraries are used in this project:\n\n### Dependencies\n\n**asgiref==3.8.1**\n\n**Django==5.1.4**\n\n**django-cors-headers==4.6.0**\n\n**django-crispy-forms==2.3**\n\n**djangorestframework==3.15.2**\n\n**gunicorn==23.0.0**\n\n**packaging==24.2**\n\n**pillow==11.1.0**\n\n**psycopg2-binary==2.9.10**\n\n**python-dotenv==1.0.1**\n\n**sqlparse==0.5.2**\n\n**tzdata==2024.1**\n\n## Problems with Deployment\nHaving problems uploading the frontend soo the frontend part is moved to own github repository.\n\n## Bugs\n\n### Known Issues\nThere are currently no known issues.\n\n### Resolved Issues\nThere are no resolved issues at this time.\n## Testing in React \n\n\n\n## Testing in Django\n\n| Test Description | Status | Notes |\n|------------------|--------|-------|\n| **Valid Post**   | ✅      | This test checks if a post request with valid data is successfully created. |\n| **Invalid Post** | ✅      | This test checks if a post request with missing description returns a bad request error. |\n\n\n## Credit\nI have taken help from the following resources:\n\n[Django Rest Framework Official Documentation](https://www.django-rest-framework.org/)\nThe go-to place for all things related to Django Rest Framework. Find detailed guides, tutorials, and API documentation to help you build powerful APIs.\n\n[Django Email Documentation](https://docs.djangoproject.com/en/5.1/topics/email/)\nOfficial Django documentation on how to send emails, configure email backends, and integrate email functionality into your Django projects.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimalexanderandersson%2Fpersonal-webpage-v1","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimalexanderandersson%2Fpersonal-webpage-v1","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimalexanderandersson%2Fpersonal-webpage-v1/lists"}