Skip to content

Instantly share code, notes, and snippets.

@nandooliveira
Forked from mario-chaves/Makefile
Created June 6, 2019 04:03
Show Gist options
  • Save nandooliveira/2bb11a69a629158defdb2a7ac0c1ed6e to your computer and use it in GitHub Desktop.
Save nandooliveira/2bb11a69a629158defdb2a7ac0c1ed6e to your computer and use it in GitHub Desktop.

Revisions

  1. @rg3915 rg3915 revised this gist Nov 21, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Makefile
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # wget https://gist.github.com/rg3915/a26a2daef369b729e2ed/raw/414368989a7656d0f7072ffa17a051d75142f250/Makefile
    # wget --output-document=Makefile https://goo.gl/UMTpZ1
    # make setup

    # Colors
  2. @rg3915 rg3915 revised this gist Nov 21, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Makefile
    Original file line number Diff line number Diff line change
    @@ -34,7 +34,7 @@ migrate:
    @./manage.py migrate

    createuser:
    @echo "${green}>>> Creating a user ...${reset}"
    @echo "${green}>>> Creating a 'admin' user ...${reset}"
    @./manage.py createsuperuser --username='admin' --email=''

    magic:
    @@ -48,7 +48,7 @@ magic:

    backup:
    @./manage.py dumpdata core --format=json --indent=2 > fixtures.json
    @echo "${green}>>> backup created with success: fixtures.json${reset}"
    @echo "${green}>>> backup created successfully: fixtures.json${reset}"

    load:
    @./manage.py loaddata fixtures.json
  3. @rg3915 rg3915 revised this gist Nov 21, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Makefile
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # wget https://goo.gl/mgm8Ij
    # wget https://gist.github.com/rg3915/a26a2daef369b729e2ed/raw/414368989a7656d0f7072ffa17a051d75142f250/Makefile
    # make setup

    # Colors
  4. @rg3915 rg3915 revised this gist Nov 21, 2015. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion Makefile
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,5 @@
    # $ make setup
    # wget https://goo.gl/mgm8Ij
    # make setup

    # Colors
    red=`tput setaf 1`
  5. @rg3915 rg3915 revised this gist Nov 21, 2015. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions Makefile
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    # $ make setup

    # Colors
    red=`tput setaf 1`
    green=`tput setaf 2`
  6. @rg3915 rg3915 revised this gist Nov 21, 2015. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions Makefile
    Original file line number Diff line number Diff line change
    @@ -42,7 +42,6 @@ magic:
    @sed -i "s/@//" myproject/urls.py
    @echo "Create the view more simple"
    @sed -i "/render/afrom django.http import HttpResponse\n\n\ndef home(request):\n return HttpResponse('<h1>Welcome to the Django.</h1>')" core/views.py
    @./manage.py runserver

    backup:
    @./manage.py dumpdata core --format=json --indent=2 > fixtures.json
    @@ -56,4 +55,4 @@ run:

    setup: venv active

    install: installdjango createproject migrate createuser magic
    install: installdjango createproject migrate createuser magic run
  7. @rg3915 rg3915 created this gist Nov 21, 2015.
    59 changes: 59 additions & 0 deletions Makefile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,59 @@
    # Colors
    red=`tput setaf 1`
    green=`tput setaf 2`
    reset=`tput sgr0`

    venv:
    @echo "${green}>>> Creating virtualenv${reset}"
    @virtualenv -p python3 venv
    @echo "${green}>>> venv is created.${reset}"

    active:
    @echo "${red}>>> Type source venv/bin/activate${reset}"
    @echo "${red}>>> Type cd djangoproject${reset}"
    @echo "${red}>>> Type make install${reset}"
    @mkdir djangoproject
    @cp Makefile djangoproject/

    installdjango:
    @echo "${green}>>> Installing the Django${reset}"
    @pip install django
    @pip freeze > requirements.txt

    createproject:
    @echo "${green}>>> Creating the project 'myproject' ...${reset}"
    @django-admin.py startproject myproject .
    @echo "${green}>>> Creating the app 'core' ...${reset}"
    @./manage.py startapp core

    migrate:
    @./manage.py makemigrations
    @./manage.py migrate

    createuser:
    @echo "${green}>>> Creating a user ...${reset}"
    @./manage.py createsuperuser --username='admin' --email=''

    magic:
    @echo "Editing settings.py"
    @sed -i "/django.contrib.staticfiles/a\@ 'core'," myproject/settings.py
    @sed -i "s/@//" myproject/settings.py
    @sed -i "/urlpatterns = \[/a\@ url(r'\^$$\', 'core.views.home', name='home')," myproject/urls.py
    @sed -i "s/@//" myproject/urls.py
    @echo "Create the view more simple"
    @sed -i "/render/afrom django.http import HttpResponse\n\n\ndef home(request):\n return HttpResponse('<h1>Welcome to the Django.</h1>')" core/views.py
    @./manage.py runserver

    backup:
    @./manage.py dumpdata core --format=json --indent=2 > fixtures.json
    @echo "${green}>>> backup created with success: fixtures.json${reset}"

    load:
    @./manage.py loaddata fixtures.json

    run:
    @./manage.py runserver

    setup: venv active

    install: installdjango createproject migrate createuser magic