godjango

package module
v1.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2023 License: BSD-1-Clause Imports: 13 Imported by: 0

README

Go-Django

A web framework built in Go, inspired by Django. This framework is still in development, and is not ready for production use.

Information

This framework, is built from the ground up, and thus there is a lot of work to be done. It is not a port of Django, but rather a re-implementation of the core concepts of Django, in Go. The default ORM we use is GORM. This is because it is one of the most popular ORM's for Go, and it is very easy to use.

Beware! Most of the code is not tested thoroughly, and there could be bugs present. If you find any bugs, please report them in the github issues page.

Make sure you have your GOPATH set up correctly.

Installing the project-setup tool
go install github.com/Nigel2392/go-django/[email protected]

This will install the go-django command-line tool, which you can use to create a new project.

Creating a new project
go-django -startproject <project-name>

This will create a new project in the current directory, with the name you specified. Following that, change into the project directory, make sure you install the latest tag. Our tags are in the format of vX.X.X.X, which might make the go tool struggle. After changing into the project directory, run the following command:

go get github.com/Nigel2392/[email protected]
go mod tidy

This will install the latest version of the framework, and update the go.mod file. Now you can run the project with the following command:

go run ./src/
Adminsite

In the main file are a few developer credentials registered. These are used to log into the adminsite. You can view the adminsite by going to the <<DOMAIN>>/admin/ url (As specified in config.go).

Finished:

  • Routing
  • Signals
  • Template file system/manager module
  • Media file system/manager module
  • middleware: CSRF protection, Sessions, AllowedHosts
  • Authentication
  • Messages (To the templates)
  • Sending emails
  • Secret keys
  • Admin panel extensions (Embed your own templates!)
  • Secure hashing with secret.Hash and secret.Compare
  • Command-line flag package
  • Project-setup tool
  • Debug recovery page middleware (Only when running with -debug flag)

In progress:

  • Forms
  • Testing
  • Documentation

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Admin

func Admin() *admin.AdminSite

func Cache

func Cache() client.Cache

func DefaultDb

func DefaultDb() db.PoolItem[*gorm.DB]

func FS

func FS() *fs.Manager

func Flags

func Flags() *flag.Flags

func Logger

func Logger() request.Logger

func Mailer

func Mailer() *email.Manager

func Middlewares

func Middlewares(m ...router.Middleware)

func Register

func Register(toAdmin bool, key db.DATABASE_KEY, models ...any)

func Run

func Run() error

func Serve

func Serve() http.Handler

func ServeRedirect

func ServeRedirect() error

func TemplateFuncs

func TemplateFuncs(t template.FuncMap)

func Templates

func Templates() *templates.Manager

Types

type App

type App app.Application

func New

func New(c AppConfig) *App

Create a new application.

type AppConfig

type AppConfig app.Config

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL