instalar entornos virtuales_brew
# install virtual environments brew
mkdir django_website
cd django_website
django_website\ brew update
django_website\ brew install pyenv-virtualenv # install virtual evnironment which
django_website\ pyenv virtualenv 3.8.10 # help install depandancies for python
# not conflicted with other # depandancies in other project
django_website\ pyenv virtualenv 3.8.10 [email protected] # name virtual # environment
# install vim if you didn't already
django_website\vim .python-version # create python version file
# in python version file put name [email protected]
# python-version file automatically activates your virtual environment
# when you " cd " into project directory
# you can also activate it manually by running "pyenv activate [email protected]" in
# terminal
django_website\pyenv virtualenvs # show installed virtual environments
# in your project folder in vs_code make folder " requirements ".
# in requirements folder make dev.txt and prod.txt
# in dev.txt write
# everything the developer needs in addition to the production requirements
-r prod.txt
#go back to terminal
djangowebsite\pip install -r requirements/dev.txt
djangowebsite\pip install django
# when install Django it will show in terminal version of Django(Django-3.0.7)
# take that version and put it in " prod.txt " file
# if I want to pin that version I will change Django-3.0.7 to Django==3.0.7
# to check if Django is installed we can run on terminal
djangowebsite\python
djangowebsite\import django
djangowebsite\print[django.get_version()]
# press CTRL + D to exit that shell
# django has django-admin with tools for creating project
djangowebsite\django-admin startproject hackershack # hackershack is name of proj.
# it will create our boilerplate for our project
# python-boilerplate puts all source code for your project under the src/<package> folder. #This contrasts with the other typical approach of leaving the python packages directly in the #root of the the source tree.
djangowebsite\ls # list hackershack website
# if I go to my vs_code project I can see " manage.py " file
# also, have folder " hackershack " with __init__.py, asgi.py, settings.py,urls.py and wsgi.py
# you can removing nasted folder hackershack by moving all files to parent folder
# you can move manage.py to root
# manage.py is our start point where we type commands to running our server
djangowebsite\python manage.py runserver # this will start our server for us
# it start our server at port:8000
# if I open my Chrome and type localhost:8000 you can see my Django site is up and running
Impossible Impala