Creating Project
In this tutorial will be creating a test-clone called "testProject"
Create a project using j25 command line tool in your workspace
A project is like a workspace that can contain several applications. The general directory structure of a project is:
testProject
-> apps #applications folder
-> static #static files
-> templates #templates that override application templates
->server.ini #configuration parameters for the J25 Server
->routing.py #routing configuration for the project
Then we will create our first application kalamna inside testProject
All applications are created inside testProject/apps and every application has the following directory structure:
Kalamna
-> lib #all classes that you need to put/write to be accessible from your application
-> static #static files (images/css/etc.)
-> tests #unit tests
-> model #model files
-> tasks #tasks files
-> tmp #used for compiled templates
-> templates #template files
-> controllers #controller files
-> routing.py #application URL routing
-> config.py #application specific configuration files
-> _init_.py #python package file
Create Model
we will be creating the model called "user" inside model directory in application dir
open the module & write the model as the following
Create Controller
we will be creating the controller called "controller1" inside controller directory in application dir
open the module & write the controller as the following
Create Router
go to project directory then write the routing in router.py module
for full documentation about how to write route click here
Create Template
create directory named the same name of the controller, then create html file inside it with the same name of the action
Note: directory templates exists in project directory and in application directory, we can use any of them depending on the case.
but remember that the templates in project dir , overwrite the templates in application dir
for full documentation about how to write template click here
Create Test
the test must simulate the real environment so we need to run mongo, web server, rabbitMQserver & celery using there fixtures and tear down after finish, as the following
go to tests directory inside application dir then create test module
open module test_kalamna and write the following
How to run tests
go to project dir then run the following commands
to run all project tests run the following command
to run specific test module
to run all kalamna application tests
to run specific test module in kalamna app.
to run specific test in specific module in kalamna app.
we will write some tests scenarios click here
