This project serves as a starting point you to use as a starting point for Django applications that use Vite as the asset server for development. You are welcome to us this project for all of your assignments beginning with Module 5.
This application is a hybrid MPA and SPA. It reuses all of the login stuff that we did at the end of module 3 - there is a separate page for signup/signin. Once a user is logged in they are redirected to the / view which then renders the SPA application created using React and Vite.
- Clone the repo
git clone [email protected]:dittonjs/2610DjangoViteStarter.git <your-new-project-name>. Replace<your-new-project-name>with the name you want give to your project.- If you are using GitHub for version control, a better option would be to fork the repository instead of clone it.
- Open the pyproject.toml file and change the
nameproperty. You should use-to separate words in your name for this property. - This project was set up using Python 3.11. You might have an older version installed. If you run into an error later that says that your activated Python version isn't compatible, the in the pyproject.toml file, just change the version there to match the version that you have installed. If you do this, you need to make sure that the lock file gets regenerated. You can do this by running
poetry lock --no-updateor by simply deleting the poetry.lock file (it will get regenerated when you run poetry install)/
- Change the name property in the
pyproject.tomlfile to be something unique to your project. - In the root directory, install the python dependencies
poetry install --no-root - In the
clientdirectory, install the javascript dependenciesnpm install - In the
_serverdirectory, create a new file called.env - Copy the contents of
_server/.env.exampleinto the newly created.envfile. - Activate the poetry env
poetry shell, or, if you do not have the poetry shell plugin usepoetry run <the command you want to run>to run somesomething - In the
_serverdirectory, run the migrationspython manage.py migrate
- In the
clientdirectory runnpm run dev - In the
_serverdirectory (with your poetry env activated) runpython manage.py runserver - Visit your application at
http://localhost:8000
Many students in the past have chosen to use this starter app template for projects in other classes like CS3450 and for personal projects. I strongly encourage you to do so! Please check with your other instructors before you use this project as a starting point for their classes. You may also want to add your name to the author field in the pyproject.toml file.