Creating a simple scafold like behaviors on django !! Not Quite

Sept. 22, 2024, 12:04 p.m.

So the other that i was coding a webapp in django, started creating a basic view.When creating the view, realize than i keep creating the same file over and over again !! So i though why not write a script that does al l the basic stuff for me.You know the basic stuff like creating views, static or template files

One might argue that why not use shell script to do the automate stuff.I am not saying that they are wrong , its just that i wanted write something in golang.

First thing i needed to do was to create function for creating the static folder in the current app.Because every time i do the the same thing, create a static folder,Inside it create css, js, img.So basicly wrote a script that does exactly that.If executed it will create a static folder with css and js.Now if one wants boostrap , one have to give boostrap as command line arguent..One thing to note here is that its generating the boostrap files in the static dir.Here i am not downloading the files from the repo or anything, its justs i copies the the files from a directory.This dir is to be set via env variable.This dir contain all the necessary files that we need to create out structure

Next thing i did is to create features that build the templates for me.The templates needs to have the app name folder inside.Inside that folder you save the html files.When the folder gets created , it creates a base.html file as well.

Last part i did (well last for the time being) is to create the appropriate views. Given a view name, it updates the urls and views files and creates an html file with that view name.After running i found that its not necessary that you will have the urls file all the time.Infact when the app gets created, its does not create the urls file.So got to fixed that for now

You check the source code from here

To be Continue ..