I started with Python last month, just to see what is the fuss about it. I can see how simple it is and that makes it quite powerful, but coming from Ruby and Ruby on Rails, I can see serious resemblance between both of them, and now with Django more of the same. It’s fine, it’s not a critic, not bad feelings, it’s just an observation, if you “jump” from one to another it will not be a “cliff jumping” just a “mud puddle” kind of jump.
Here the steps to have a Django project kicking in no-time. You must have previously python 3 installed ( I followed these steps ). I did in a Windows 10 machine, so this my list of steps. Open a Powershell with Administrator rights and start typing:
# Create directory for your new project mkdir blog cd blog # Create a virtual environment for your project python -m venv ll_env ll_env\Scripts\activate # to stop it deactivate # Install Django pip install django # Create the project in Django ATTENTION: Don't forget the . at the end!!! django-admin startproject blog . # Creating the database SQLite python manage.py migrate # Viewing the project python manage.py runserver # go to http://127.0.0.1:8000 # Tada!!!! # Create an App inside your project # Your virtual environment must be activated ll_env\Scripts\activate python manage.py startapp blogs
You will have to modify settings.py in under your project “Blog” to add your app, so it looks like:
..... Snip ..... INSTALLED_APPS = [ # My apps 'blogs', # Default django apps 'django.contrib.admin', 'django.contrib.auth', ..... Snip .....
# Let's create a superuser for our admin part python manage.py createsuperuser (enter username, and password of your choice, the email is totally optional)
And now you can login in your app as superuser in the admin area : http://127.0.0.1:8000/admin/
And now it’s when you start creating models, views, templates, etc.