Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Third step creating python project

// go to mainControl folder 
// create a new folder - static 
// inside the STATIC folder paste all the following folders
// assets, css, img, js, vendor, video, master etc. 
// go to settings.py - paste the code below 
STATIC_URL = 'static/'
      // below code should be above is default 
STATIC_ROOT =  BASE_DIR / 'static'
STATICFILES_DIRS = [
    'mainControl/static',
]

// installing COLLECTSTATIC from the TERMNIAL 
python manage.py collectstatic 
// right after the installation you will see the generated 
// folder called "static" direct from your project folder
// enter to install 
// to run the static you must have to load like below 
{% load static %} 
// note if encountered error about static, just load it to the specific folder
// after you need to do the following like: 
<link rel="stylesheet" 
 href="{% static 'vendor/bootstrap/css/bootstrap.min.css'%}">
// and also the following like: 
<script src="{% static 'vendor/jquery/jquery.min.js'%}"></script>
// after try to runserver to test if there will no errors
python manage.py runserver 
// use to test the program 
// --------------------------------------
// to do the shortcup the following below
// drug and drap into your code editor the 
// the "Re-Usable folder " rename it into "new project name "
// go to the TERMINAL 
 cd nameOfProject
// running server to test 
 python manage.py runserver 
 
 
PREVIOUS NEXT
Tagged: #Third #step #creating #python #project
ADD COMMENT
Topic
Name
4+8 =