Hi,
Go through this quick start tutorial and understand. You can do this. It is very easy.
https://www.django-rest-framework.org/tutorial/quickstart/
Thanks and Regards
J. Ranga Bharath
Cell: 9110334114
J. Ranga Bharath
Cell: 9110334114
On Wed, 31 May 2023, 2:16 pm DieHardMan 300, <keenusuwannabut@gmail.com> wrote:
I'd like to give some advice before start your Django journey and Django project configurations---------- Before Start Django ----------1. master Python "class" bacause you might use django class-based view a lot, learn "decorator" and standard library "datetime" and "re"2. choose "Python version" for your django project, I recommend Python 3.10 or 3.11. You should check current installed Python versionin your terminal --> py --version** if you use Unix OS like MacOS or Linux, type "python3" instead of "py"3. I highly recommend create virtual environment for each django project, install virtualenv with pipwindows cmd --> py -m pip install virtualenvthen --> py -m virtualenv app-envmacos terminal --> python3 -m pip install virtualenvthen --> python3 -m virtualenv app-env4. activate virtual environment you just createdwindows cmd --> app-env\Scripts\activate.bat or app-env\Scripts\activatemacos terminal --> source/bin/activateto stop virtualenv just type --> deactivate5. install django latest version via pip (you must activate virtualenv first)--> py -m pip install django---------- Start Django ----------1. start new django project (don't forget to activate virtualenv first)--> django-admin startproject my-app2. go inside project folder and create "requirements.txt" and type all requirement library for your project--- requirements.txt ---django >= 4.2.0, < 4.3.0wheel >= 0.4.0ipython >= 8.11.0 # python shell for django projectpython-decouple >= 3.7.0 # for hiding sensitive data in settings.py before uploading to gitsetuptools >= 67.7.0psycopg >= 3.0.0 # postgresql database driver. if you use django 4.1 or lower you must install psycopg2 instead of psycopgmysqlclient => 2.1.1 # mysql database driver. if you already use postgresql you don't need this3. install specified dependencies--> py -m pip install -r requirements.txtfor upgrade your dependencies --> py -m pip install --upgrade -r requirements.txtby doing this you have more control to your project dependenciesfor example if you specified "django >= 4.2.0, < 4.3.0" it will upgrade django between 4.2.0 to 4.2.* but never 4.3.04. in your main project directory it will have 3 files nowmy-app, manage.py and requirements.txt5. open "settings.py" in "my-app"first thing you need to be cautious is SECRET_KEY constant. You must never lose it or expose this to public that's why "python-decouple" library neededfor more information https://pypi.org/project/python-decouple/6. in DATABASE section change it to your database--- for postgresql ---DATABASES = {'default': {DATABASE_ENGINE='django.db.backends.postgresql'DATABASE_NAME='mydatabase'DATABASE_USER='root'DATABASE_PASSWORD=''DATABASE_HOST='localhost'DATABASE_PORT='5432'}}--- for mysql ---DATABASES = {'default': {ALLOWED_HOSTS='localhost'DATABASE_ENGINE='django.db.backends.mysql'DATABASE_NAME='mydatabase'DATABASE_USER='root'DATABASE_PASSWORD=''DATABASE_HOST='localhost'DATABASE_PORT='3306'}add your "user" and "password", both database port above are default port though7. start your first database migrate--> py manage.py migrateNow go for Django Tutorial --> https://docs.djangoproject.com/en/4.2/I hope this help you avoid some problems in the future.--ในวันที่ วันอังคารที่ 30 พฤษภาคม ค.ศ. 2023 เวลา 21 นาฬิกา 56 นาที 14 วินาที UTC+7 Veronica Ndemo เขียนว่า:Hi guys I need help.I am just getting started in using Django and I would love to get guidance on how to go about the Django framework
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/8f7da283-844b-4fd3-aa73-324a5ada7d7cn%40googlegroups.com.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAK5m316NYXbxJXg0skFM79dKANbqKq%2BnL-eMayU9w9qFtNHzSg%40mail.gmail.com.
No comments:
Post a Comment